[plt-scheme] call/cc and generators

From: Jos Koot (jos.koot at telefonica.net)
Date: Sat May 1 01:51:59 EDT 2010

When generating all rearrangements of a list (with or without duplicates)
This can be done with only one natural number for the internal state, but
call/cc seems more efficient to me.


From: plt-scheme-bounces at list.cs.brown.edu
[mailto:plt-scheme-bounces at list.cs.brown.edu] On Behalf Of Skeptic .
Sent: 01 May 2010 03:11
To: plt-scheme at list.cs.brown.edu
Subject: [plt-scheme] call/cc and generators


Generators are often given as good usage of call/cc, but in many cases it
seems to me that explicitly saving the state is simple enougth that
capturing the continutation is not needed.

For example, if one wants to do something like (make-unfold-generator ...)
it is easy to manage the unfold index inside a closure.

The only good counter-example I have seen and used before is a recursive
tree traversal, in this case call/cc appears to be the only way to go. 

I'm curious if someone have other examples of generators where call/cc is a
good solution (or any interesting not-too-complex usage of call/cc).



Emmenez vos contacts faire un tour. Essayez Messenger
<http://go.microsoft.com/?linkid=9724467> version mobile 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100501/d3183d50/attachment.html>

Posted on the users mailing list.