* inconsistency between let and lambda
@ 2011-01-13 16:58 Joo ChurlSoo
2011-01-15 20:42 ` Neil Jerram
0 siblings, 1 reply; 2+ messages in thread
From: Joo ChurlSoo @ 2011-01-13 16:58 UTC (permalink / raw)
To: guile-user
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>
--
Joo ChurlSoo
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: inconsistency between let and lambda
2011-01-13 16:58 inconsistency between let and lambda Joo ChurlSoo
@ 2011-01-15 20:42 ` Neil Jerram
0 siblings, 0 replies; 2+ messages in thread
From: Neil Jerram @ 2011-01-15 20:42 UTC (permalink / raw)
To: Joo ChurlSoo; +Cc: guile-user
Joo ChurlSoo <initerm@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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-15 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 16:58 inconsistency between let and lambda Joo ChurlSoo
2011-01-15 20:42 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).