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
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 ?
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
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?
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.
············@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