Subject: Re: Why no call with current continuation? From: Erik Naggum <erik@naggum.no> Date: 02 Oct 2002 23:21:15 +0000 Newsgroups: comp.lang.lisp Message-ID: <3242589675749194@naggum.no> * Tim Josling | I am wondering why there is no call/cc in lisp. It seems to be potentially | useful. Please get back to us when it is /actually/ useful. | For example, in the book 'On Lisp', a significant part of this excellent | book seems to consists of reinventing various cut down versions of | call/cc. Well, duh. | (Call/cc is a way to save the current state of the program in a | variable. You can use the variable later on onto resume processing at | that point. It can be used for coroutines, exception handling, | nondeterministic search, etc.) None of us know Scheme at all, so thanks for this lecture. | To my naive point of view this seems to be contrary to the usual lisp | approach. In your next life, learn a real Lisp before Scheme. This will change what you consider "usual" as well as actually help grasp a hell of lot more than you do now. | Three possibilities as to why call/cc is not in lisp occur to me: | | 1. For some reason it is not seen as useful. But to me it seems useful. That is because you have yet to learn how useful the Common Lisp constructs are. A common affliction of Scheme users is to believe that their ignorance of Common Lisp gives them a right to tell people about Scheme, which they know. This is actually nuts. | 2. It is too hard to implement efficiently - period. I don't know enough | about implementing functional languages to say for sure, though it does | look like it might be a challenge to implement e.g. maybe you need to | copy the stack. You do no implement languages with call/cc with ordinary stacks. Stacks are normally used to contain call frames. This works well because calls are strictly hierarchical. With call/cc, this is no longer true, so call frames need to be allocated from the heap and garbage-collected instead of the stack memory being trivially reusable. | 3. It can be implemented efficiently in scheme, but is too hard to | implement efficiently in lisp. I can't see any reason why this would be | the case. Lisp is bigger than scheme but the core of the language does | not look that much bigger to me. Do you actually believe this nonsense to be true? | Can anyone shed any light on this? If someone wants to use this as a | springboard for a lisp versus scheme discussion, please start another | thread. (In my view lisp and scheme both have good reasons to exist. I think both antibiotics and bacteria have good reason to exist, too. -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.