3 ms·
I don't know if it gets any more obscure than Scheme's call/cc, which is a building block for other control flow structures. You can use it for cool things lik
by brlewis 15y ago
I don't know if it gets any more obscure than Scheme's call/cc, which is a building block for other control flow structures. You can use it for cool things like the Racket web server, where event-driven programming can be made to feel like sequential, procedural-style programming. You can also use it for sick mind twisters like ((call/cc call/cc) (call/cc call/cc))
- skimbrel 15y agoI remember being shown call/cc briefly in CS 61A at Berkeley and then forgetting about it until recently when I saw an article on it while I was in the middle of writing an event-driven web application using Perl and Plack. I immediately saw how useful it would be and wished I had it available to use there.
- itmag 15y agoPlease explain :)
- brlewis 15y agoGood explanation here: http://lambda-the-ultimate.org/node/86#comment-3806 http://lambda-the-ultimate.org/node/86#comment-3806 But you have to read it slowly.
- itmag 15y agoMine lisp-peen is too small. Now, off to study! Thanks, btw.
- spacemanaki 15y agoI don't think I ever really understood call/cc until I read Lisp in Small Pieces. The author makes a great effort to implement call/cc in each of the interpreters and compilers he presents, and examines the hairy issues that come up when you decide to support first-class continuations. Highly recommended.
- JonnieCache 15y agoRuby has call/cc http://rubydoc.info/stdlib/core/1.9.3/Kernel:callcc http://rubydoc.info/stdlib/core/1.9.3/Kernel:callcc Thus you can implement pretty much anything you want in ruby, including COME FROM.