Re: Macro expansion

2011-01-15 Thread Neil Jerram
Hans Aberg  writes:

> In the code below the 'loop' and 'begin' examples will execute the
> while' loop, but if put into the body of a function, 'while' will not
> run. So why, and how to fix it?
>
> Just copy and paste the examples below into guile. For the two first,
> I get
>   0123456789
>   0123456789done!3
> but for the third, the thunk, only
>   done!3

With my current Guile,

scheme@(guile-user)> (version)
$4 = "1.9.14.17-44f43"

the third case behaves as you would expect:

scheme@(guile-user)> ((lambda
  ()
  (begin
(loop ((define i 0))
 (< i 10)
 ((set! i (+ i 1)))
 ((display i)))
(display "done!")
(+ 1 2)
  )
))
0123456789done!$5 = 3

Regards,
Neil



Re: inconsistency between let and lambda

2011-01-15 Thread Neil Jerram
Joo ChurlSoo  writes:

> The following behavior of `let' seems to be wrong.
>
> guile> (version)
> "1.8.8"
> guile> 
> (let ((go #f)
>   (alist '()))
>   (let ((a 1) (b (call-with-current-continuation (lambda (x) (set! go x) 2
> (set! alist (cons (cons a b) alist))
> (set! a 100)
> (set! alist (cons (cons a b) alist))
> (if (< (length alist) 3)
>   (go 2)
>   (reverse alist
> ((1 . 2) (100 . 2) (100 . 2) (100 . 2))
> guile>;; inconsistency between let and lambda
> (let ((go #f)
>   (alist '()))
>   ((lambda (a b)
>  (set! alist (cons (cons a b) alist))
>  (set! a 100)
>  (set! alist (cons (cons a b) alist))
>  (if (< (length alist) 3)
>(go 2)
>(reverse alist)))
>1 (call-with-current-continuation (lambda (x) (set! go x) 2
> ((1 . 2) (100 . 2) (1 . 2) (100 . 2))
> guile>

For what it's worth, my current Guile, from Git post 1.9.14, gives ((1
. 2) (100 . 2) (1 . 2) (100 . 2)) for both cases.

 Neil



Re: Macro expansion

2011-01-15 Thread Hans Aberg


On 15 Jan 2011, at 21:39, Neil Jerram wrote:


With my current Guile,

scheme@(guile-user)> (version)
$4 = "1.9.14.17-44f43"

the third case behaves as you would expect:


That is right, I used the stable versions 1.8.x, x = 7, 8.  
Unfortunately, when I try to install guile-1.9.14, I get the error  
below (Mac OS X 10.5.8 PPC G4).




ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o  
and .libs/libguile_2.0_la-alist.o