[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme mistakes (was Re: nil)
From: "Joe Marshall" <jrm@ccs.neu.edu>
Date: Thu, 14 Aug 2003 16:09:20 -0400
From: "Alan Bawden" <Alan@lcs.mit.edu>
>
> Consider evaluating:
>
> (throw (f x) 42)
>
> Since you know that the expression `(f)' must yield a continuation, the
> old continuation can be discarded (and perhaps reclaimed by the garbage
> collector) -before- you call the function `f'.
(throw (call-with-current-continuation (lambda (c) ...)) 42)
What about it? In this case `c' will be a continuation that expects
another continuation, which will in turn be passed `42'. So:
(throw (call-with-current-continuation (lambda (c) (throw c k))) 42)
is the same as:
(throw k 42)