|
From: | Joo ChurlSoo |
Subject: | inconsistency between let and lambda |
Date: | Fri, 14 Jan 2011 01:58:50 +0900 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |