Shiro Kawai | 2 Aug 2008 05:36
Favicon

Re: write-object from write vs. from display

From: "Leonardo Boiko" <leoboiko <at> gmail.com>
Subject: Re: [Gauche-devel] write-object from write vs. from display
Date: Tue, 29 Jul 2008 19:57:25 -0300

> 2008/7/29 Shiro Kawai <shiro <at> lava.net>:
> > How about this.  In your write-object method you can call write-mode
> > procedure that returns a symbol indicating which mode it is called.
> >
> >  (write-mode) => a symbol
> 
> I still don't get it; will the user ever need to set the write-mode?
> If not, wouldn't it be simpler to just make write-object receive two
> arguments, the object and the write-mode?

That was the original plan.  The problem is this: It is quite
common to call 'format' from write-object, but there's no way
to pass the mode info to 'format'.

(define-method write-object ((obj <my-object>) port mode)
  (format port "...." ...))

We can add a new function, say 'format/mode' and 'format/ss/mode',
that takes extra mode argument.  But we can't save the existing
write-object methods that are using standard 'format'---it means
for any recursive structure, we can't rely on the mode argument to 
propagate down.  With the parameter approach, we don't need to
worry about propagation part.

--shiro

(Continue reading)

Bill Schottstaedt | 9 Aug 2008 21:52
Picon

expt hangs

I think the expression (expt 1/500029 362880/3) causes Gauche to hang.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Shiro Kawai | 9 Aug 2008 23:15
Favicon

Re: expt hangs

From: "Bill Schottstaedt" <bil <at> ccrma.Stanford.EDU>
Subject: [Gauche-devel] expt hangs
Date: Sat, 9 Aug 2008 12:52:15 -0700

> I think the expression (expt 1/500029 362880/3) causes Gauche to hang.

Not exactly.  It just takes long to calculate.

gosh> (time (begin (expt 1/500029 362880/3) #t))
;(time (expt 1/500029 120960))
; real   9.364
; user   9.340
; sys    0.000
#t

But more importantly, it takes way too long to *print* it.
Note that you're asking exact calculation.  The result
will be something like:

   1/........huge_number.........

The denominator will be about 690000 digits long.
Converting bignum binary to decimal involves lots of
divisions of bignums.

Exact numeric arithmetics is not in Gauche's emphasis; it
uses n^2 algorithm for bignum multiplication and division,
so the performance deteriorates quickly if the number gets
huge.   The question is, do you need exact calculation here?

(Continue reading)

Stas Boukarev | 28 Aug 2008 22:55
Picon

Connecting 2 processes by a pipe

How one can connect two processes by a pipe like "cat file | wc -l"?
I read "9.16 gauche.process" section of the manual but still can't get it.

--

-- 
With Best Regards, Stas.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Shiro Kawai | 29 Aug 2008 00:19
Favicon

Re: Connecting 2 processes by a pipe

From: "Stas Boukarev" <stassats <at> gmail.com>
Subject: [Gauche-devel] Connecting 2 processes by a pipe
Date: Fri, 29 Aug 2008 00:55:22 +0400

> How one can connect two processes by a pipe like "cat file | wc -l"?
> I read "9.16 gauche.process" section of the manual but still can't get it.

The general way is a bit cumbersome in the current Gauche.
If you're looking for a quick way, delegating the piping
work to the shell is the easiest.  For example:

  (process-output-≥string "cat file | wc -l")

If you don't want shell to be involved, you have to do the job
what shells are doing: Create pipes and connect the processes
with them.  The high-level process interface doesn't help much,
unfortunately.  This is a quick sample I typed in my REPL:

gosh> (receive (i0 o0) (sys-pipe)
        (receive (i1 o1) (sys-pipe)
          (let ((p1 (sys-fork-and-exec "cat" '("cat" "configure")
                                       :iomap `((1 . ,o0) (2 . 2))))
                (p2 (sys-fork-and-exec "wc" '("wc" "-l")
                                       :iomap `((0 . ,i0) (1 . ,o1) (2 . 2)))))
            (close-output-port o0)
            (close-output-port o1)
            (read-line i1))))
"2625"

Basically, what it does is to connect processes using two pipes:
(Continue reading)


Gmane