[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Printing procedures returned from call/cc
From: |
Thomas Chust |
Subject: |
Re: [Chicken-users] Printing procedures returned from call/cc |
Date: |
Tue, 31 Jul 2012 15:24:16 +0200 (CEST) |
User-agent: |
Alpine 2.02 (LNX 1266 2009-07-14) |
On Tue, 31 Jul 2012, Jeronimo Pellegrini wrote:
[...]
I was wondering why this happens in Chicken (recent checkout from git):
(let ((lst (call/cc (lambda (x)
(print 'something)
(call/cc (lambda (y)
(list x y)))))))
(print lst)
(print (eq? (car lst) (cadr lst)))
(print (eqv? (car lst) (cadr lst)))
==>
(#<procedure (f_10734 . results1838)> #<procedure (f_10734 . results1838)>)
#f
#f
The procedures returned are different continuations (and of course
they are certainly not eq? or eqv?).
[...]
Hello,
this is really strange!
Since the second lambda expression is in tail position with respect to the
first, the two continuations x and y are actually equivalent, so at first
I was less surprised by their printed representation than by the results
of the equality predicates.
But then I tried to wrap some other function call around the inner
invocation of call-with-current-continuation -- and the two continuation
procedures still had the same printed representation.
I guess one just cannot rely on intuition in this case ;-)
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.
smime.p7s
Description: S/MIME Cryptographic Signature