Joo ChurlSoo <init...@gmail.com> 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

Reply via email to