From: David Bakhash
Subject: decls with LOOP variables
Date: 
Message-ID: <c291z2fewe1.fsf@mint-square.mit.edu>
hi,

one of the problems with LOOP is that I can't delcare loop variables as
ignored.  for example:

(loop for (key . value) in my-list
  do (foo value))

I want to ignore the KEY variable.  Of course, I realize that in this
case I can say 

(loop for cons in my-list 
      for value = (cdr cons)
      do (foo value))

But what I'd like to know is if there's a way to declare KEY as
ignored.  In Perl's version of destructuring, one does this by using
`undef' (Perl's NIL) in that place, which would look something like:

(loop for (nil . value) in my-list
 ...)

of course, that's bad.  But is this just a limitation of LOOP?

thanks,
dave

From: Rainer Joswig
Subject: Re: decls with LOOP variables
Date: 
Message-ID: <rainer.joswig-C3929E.21592602062000@news.is-europe.net>
In article <···············@mint-square.mit.edu>, David Bakhash 
<·····@alum.mit.edu> wrote:

> (loop for (nil . value) in my-list
>  ...)

(LOOP for (nil . value) ...

is the way.

The Hyperspec says in "6.1.1.7 Destructuring":
 "If nil is used in a destructuring list, no
  variable is provided for its place."

-- 
Rainer Joswig, BU Partner,
ISION Internet AG, Steinh�ft 9, 20459 Hamburg, Germany
Tel: +49 40 3070 2950, Fax: +49 40 3070 2999
Email: ····················@ision.net WWW: http://www.ision.net/
From: David Bakhash
Subject: Re: decls with LOOP variables
Date: 
Message-ID: <c29ya4nde05.fsf@mint-square.mit.edu>
Rainer Joswig <·············@ision.net> writes:

> ::::::::::::::
> /tmp/mm.0Td3SB
> ::::::::::::::
> In article <···············@mint-square.mit.edu>, David Bakhash 
> <·····@alum.mit.edu> wrote:
> 
> > (loop for (nil . value) in my-list
> >  ...)
> 
> (LOOP for (nil . value) ...
> 
> is the way.
> 
> The Hyperspec says in "6.1.1.7 Destructuring":
>  "If nil is used in a destructuring list, no
>   variable is provided for its place."

wow.  I would never have guessed that!

actually, I don't know if I even like that or not, but oh well.

thanks for reading the spec for me :-)

dave
From: Barry Margolin
Subject: Re: decls with LOOP variables
Date: 
Message-ID: <Z6VZ4.112$7d6.1025@burlma1-snr2>
In article <···············@mint-square.mit.edu>,
David Bakhash  <·····@alum.mit.edu> wrote:
>actually, I don't know if I even like that or not, but oh well.

Destructuring has existed longer than the IGNORE declaration -- it goes
back to Maclisp, which didn't have the declaration.  So some way had to be
found to mark places in the destructuring pattern that shouldn't be filled
in, and NIL was the obvious candidate (you can't bind NIL as a variable,
and it doesn't usually make sense for a pattern to require an empty list in
a particular place).

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.