Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Iteration constructs that handle multiple values?

8 views
Skip to first unread message

Sunil Mishra

unread,
Jul 25, 1996, 3:00:00 AM7/25/96
to

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:

(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

Erik Naggum

unread,
Jul 26, 1996, 3:00:00 AM7/26/96
to

[Raymond Toy]

| 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


Raymond Toy

unread,
Jul 26, 1996, 3:00:00 AM7/26/96
to

smi...@sthelen.ai.mit.edu (Sunil Mishra) writes:

>
> 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

Roly Perera

unread,
Jul 27, 1996, 3:00:00 AM7/27/96
to

> | 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_.

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
----


Lou Steinberg

unread,
Jul 27, 1996, 3:00:00 AM7/27/96
to

In article <30473797...@arcana.naggum.no> Erik Naggum <er...@naggum.no> writes:

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.

Barry Margolin

unread,
Aug 3, 1996, 3:00:00 AM8/3/96
to

In article <ulog26g...@sthelen.ai.mit.edu>,

Sunil Mishra <smi...@sthelen.ai.mit.edu> wrote:
>I have been trying to figure out if there are any iteration constructs that
>can deal with functions that return multiple values correctly.

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)

0 new messages