[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: |
Peter Bex |
Subject: |
Re: [Chicken-users] Printing procedures returned from call/cc |
Date: |
Tue, 31 Jul 2012 17:52:57 +0200 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Jul 31, 2012 at 03:24:16PM +0200, Thomas Chust wrote:
> 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)))
>
> 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.
Same here. I think what we're seeing here is the same procedure but
different closure objects (one has access to 'x', the other to 'y').
Only the procedure name is printed.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth