(do ((foo nil)
(bar nil))
(exit-condition
result)
(multiple-value-setq (foo bar)
(function-call))
...)
I think of this as rather crude and error prone.
If there isn't, why not?
Sunil
| Paul Graham's (?) book "On Lisp" has a macro mvdo that handles this.
| Great book. If you use lisp, get a copy.
as Asle Olufsen mentioned here previously, this book is out of print. is
there anything we can do to convince Prentice Hall that that was not a wise
move? the book is _excellent_.
#\Erik
>
> I have been trying to figure out if there are any iteration constructs that
> can deal with functions that return multiple values correctly. A construct
> that would handle this correctly would do something like the destructuring
> bind that the for clause in a loop can do, only over multiple values rather
> than over cons'es. I certainly do not mean doing what I have been reduced
> to right now:
>
Paul Graham's (?) book "On Lisp" has a macro mvdo that handles this.
Great book. If you use lisp, get a copy. I think you might find the
source code from the book online somewhere. Check your favorite Lisp
pointers.
Ray
Yes, this book really is good. I'm surprised it's out of print, it's
reasonably well known as was only published in 1994. According to the
book, the source code for examples should be downloadable by anonymous FTP
from endor.harvard.edu, but I couldn't connect to this address. Maybe it's
changed. ftp.harvard.edu doesn't seem to allow anonymous login.
I've sent email to onl...@das.harvard.edu about this, if I get a reply I'll
post info. to the list.
--
Roly Perera
----
Interactive Computers Ltd
3 Cumberland Road
Acton
London W3 6EX
Phone: +44 (956) 414 395
Phax: +44 (181) 932 2490
Email: ro...@private.nethead.co.uk
----
as Asle Olufsen mentioned here previously, this book [Graham's book "On
Lisp"] is out of print.
What !?! Horrible news. This is a book that EVERY practicing Lisp
programmer should read, as well as anyone interested in programming
language design.
I think LOOP can do it, by making use of destructuring:
(loop for (values foo bar) = (function-call)
until (exit-condition)
do ...)
--
Barry Margolin
BBN Planet, Cambridge, MA
bar...@bbnplanet.com - Phone (617) 873-3126 - Fax (617) 873-6351
(BBN customers, please call (800) 632-7638 option 1 for support)