From: Sunil Mishra
Subject: Iteration constructs that handle multiple values?
Date: 
Message-ID: <ulog26gazhr.fsf@sthelen.ai.mit.edu>
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

From: Raymond Toy
Subject: Re: Iteration constructs that handle multiple values?
Date: 
Message-ID: <4nwwzrkwon.fsf@rtp.ericsson.se>
·······@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
From: Erik Naggum
Subject: Re: Iteration constructs that handle multiple values?
Date: 
Message-ID: <3047379774826803@arcana.naggum.no>
[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
From: Roly Perera
Subject: Re: Iteration constructs that handle multiple values?
Date: 
Message-ID: <01bb7bd5$8fac39e0$168549c2@my-computer>
> |   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 ······@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: ·····@private.nethead.co.uk
----
From: Lou Steinberg
Subject: Re: Iteration constructs that handle multiple values?
Date: 
Message-ID: <LOU.96Jul27231414@atanasoff.rutgers.edu>
In article <················@arcana.naggum.no> Erik Naggum <····@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.  
From: Barry Margolin
Subject: Re: Iteration constructs that handle multiple values?
Date: 
Message-ID: <4u0iqa$e2i@tools.bbnplanet.com>
In article <···············@sthelen.ai.mit.edu>,
Sunil Mishra <·······@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
······@bbnplanet.com -  Phone (617) 873-3126 - Fax (617) 873-6351
(BBN customers, please call (800) 632-7638 option 1 for support)