From: Sven-Olof Nystrom
Subject: List comprehensions for Lisp
Date: 
Message-ID: <m3bruaboq9.fsf@h201n2fls305o851.telia.com>
I've written an implementation of list comprehensions for Common
Lisp. My implementation also allows manipulation of hash tables and
arrays.

Documentation and source code can be downloaded at
<http://www.csd.uu.se/~svenolof/collect.tar.gz>.


Sven-Olof Nystrom

From: Jacek Generowicz
Subject: Re: List comprehensions for Lisp
Date: 
Message-ID: <tyfwucy2n5q.fsf@pcepsft001.cern.ch>
Sven-Olof Nystrom <·@h201n2fls305o851.telia.com> writes:

> I've written an implementation of list comprehensions for Common
> Lisp. My implementation also allows manipulation of hash tables and
> arrays.
> 
> Documentation and source code can be downloaded at
> <http://www.csd.uu.se/~svenolof/collect.tar.gz>.

Taking the first example in your docs:

  (collect (list) ((* x x))
    (in (x) '(1 2 3 4 5 6 7 8)))

Is there a good reason for preferring this over

  (collect list (* x x)
    (in (x) '(1 2 3 4 5 6 7 8)))

In other words, do the parentheses in 

  <type-exp> ::= (nil) | (t) | (list) | (vector) 

and those in <exp>, sereve any good purpose ?
From: Sven-Olof Nystrom
Subject: Re: List comprehensions for Lisp
Date: 
Message-ID: <m365kdq32a.fsf@h201n2fls305o851.telia.com>
Jacek Generowicz <················@cern.ch> writes:

> Sven-Olof Nystrom <·@h201n2fls305o851.telia.com> writes:
> 
> > I've written an implementation of list comprehensions for Common
> > Lisp. My implementation also allows manipulation of hash tables and
> > arrays.
> > 
> > Documentation and source code can be downloaded at
> > <http://www.csd.uu.se/~svenolof/collect.tar.gz>.
> 
> Taking the first example in your docs:
> 
>   (collect (list) ((* x x))
>     (in (x) '(1 2 3 4 5 6 7 8)))
> 
> Is there a good reason for preferring this over
> 
>   (collect list (* x x)
>     (in (x) '(1 2 3 4 5 6 7 8)))
> 
> In other words, do the parentheses in 
> 
>   <type-exp> ::= (nil) | (t) | (list) | (vector) 
> 
> and those in <exp>, sereve any good purpose ?

Sure.

If we are only interested in working with lists and (one-dimensional)
arrays, the syntax you suggest is sufficient. However, if we want to
collect the result in a hash table, we want to say how the values with
a particular key are o be collected. For example: 

(collect (hash-table (vector)) ((mod x 2) x) 
  (in (x) '(1 2 3 4 5 6)))

Here, all values with the same key are collected in a vector. The
collect expression generates a sequence of key-value pairs (the key
given by (mod x 2)). Thus, the result of the collect expression is
(under clisp):

#S(HASH-TABLE EQL (0 . #(2 4 6)) (1 . #(1 3 5)))



Sven-Olof
From: Eric Smith
Subject: Re: List comprehensions for Lisp
Date: 
Message-ID: <ceb68bd9.0308310554.3f321e39@posting.google.com>
Sven-Olof Nystrom <·@h201n2fls305o851.telia.com> wrote in message news:<··············@h201n2fls305o851.telia.com>...

> I've written an implementation of list comprehensions for Common

How is this fundamentally different from
the list functionality provided by standard
Common Lisp?  If I use dolist, loop, the
various kinds of map, etc., instead of your
list comprehensions, am I missing something
fundamental without understanding what I'm
missing?  Is there some kind of powerful
idea in this, or is it more of a convenience
for those who detest loop?
From: David Golden
Subject: Re: List comprehensions for Lisp
Date: 
Message-ID: <235b265c.0308310901.522c955d@posting.google.com>
Sven-Olof Nystrom <·@h201n2fls305o851.telia.com> wrote in message news:<··············@h201n2fls305o851.telia.com>...
> I've written an implementation of list comprehensions for Common
> Lisp. My implementation also allows manipulation of hash tables and
> arrays.
> 
> Documentation and source code can be downloaded at
> <http://www.csd.uu.se/~svenolof/collect.tar.gz>.
> 
> 
> Sven-Olof Nystrom

Does this relate to the old SERIES stuff or is it something else?
http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/node347.html

What's happened to http://series.sourceforge.net/ -
actual tarballs of series no longer seem to be there.
From: Sven-Olof Nystrom
Subject: Re: List comprehensions for Lisp
Date: 
Message-ID: <m31xv1pbmt.fsf@h201n2fls305o851.telia.com>
············@oceanfree.net (David Golden) writes:

> Does this relate to the old SERIES stuff or is it something else?
> http://www-2.cs.cmu.edu/Groups/AI/html/cltl/clm/node347.html

No, it is not based on the series library (and I was not aware of the
series library before your post.) 


Sven-Olof