chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] continuation example: different behavior from other


From: felix . winkelmann
Subject: Re: [Chicken-users] continuation example: different behavior from other Scheme implementations
Date: Sat, 19 Oct 2019 14:18:56 +0200

> Could someone please explain what's going on? Why would Chicken append
> the new list to the old value of 'numbers', which as I understand should
> be empty at the moment of the stored continuation?

You are re-entering the execution of "map" by calling the stored
continuation, which was at that point of time in the process of
producing a list, and thus is entered again, producing yet another
list of six values (since that is the state of the world captured in
the first element of "continuations". The exact behaviour of re-
entering a continuation captured during execution of "map" is, I think,
dependent on implementation details (there may be a note about this in the
SRFI-1 document or R7RS, I can't remember right now).

Note also that the "old value of numbers" that you speak of above
is the value of a global variable, which will not be part of the continuation.
It's the computation that produces the result that you re-enter.

I hope this is somewhat understandable, apologies if I failed to make it so.


felix




reply via email to

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