guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inconsistency between let and lambda


From: Neil Jerram
Subject: Re: inconsistency between let and lambda
Date: Sat, 15 Jan 2011 20:42:25 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Joo ChurlSoo <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]