This is the cl-lc Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:05:29 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-lc
List comprehensions
Paul M. Rodriguez <pmr@ruricolist.com>
MIT
alexandria
(system).
optima
(system).
iterate
(system).
package.lisp
(file).
cl-lc.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-lc/cl-lc.lisp
package.lisp
(file).
cl-lc
(system).
clause-for-over-1
(macro).
defcomp
(macro).
ensure-head
(function).
generator?
(function).
handle-inline-conditions
(function).
lc
(macro).
lcrec
(function).
parse-generator
(function).
reduction
(macro).
seq-dispatch
(macro).
Packages are listed by definition order.
cl-lc
alexandria
.
common-lisp
.
iterate
.
optima
.
clause-for-over-1
(macro).
defcomp
(macro).
ensure-head
(function).
generator?
(function).
handle-inline-conditions
(function).
lc
(macro).
lcrec
(function).
parse-generator
(function).
reduction
(macro).
seq-dispatch
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Like a list comprehension but, as soon as any result is nil, stop evaluating and return ‘nil’ from the whole form.
Like a list comprehension but, as soon as any result is non-nil, stop evaluating and return it from the whole form.
Like a list comprehension but, instead of collecting the results, count them if they are non-nil.
Like a list comprehension, but collect the results into a new ’equal hash table instead. Each key and value should be returned as separate values.
Imperative macro for list comprehension–like iteration.
QS are like the filters and generators of a list comprehension; BODY is like its expression. No reducing or accumulating is done.
A list comprehension.
A list comprehension consists of an expression, whose results will be
collected, followed by a list of filters and generators.
Generators are expressions with a keyword as their second argument.
(list-of x (for x in xs))
≡ (mapcar #’identity xs)
The binding of a generator can use destructuring:
(list-of key ((key . value) :in alist))
Generators can be made parallel simply by enclosing them in a list.
(list-of (list x y)
((for x in xs) (for y in ys)))
≡ (list-of (list x y)
(for (x y) in (mapcar #’list xs ys)))
Filters are ordinary expressions that filter the results of each
generator:
(list-of x (for x in (iota 10)) (evenp x))
=> (2, 4, 6, 8, 10)
You may use ‘if’, ‘when’, and ‘unless’ as syntactic sugar:
(list-of x (for x in (iota 10)) if (evenp x))
=> (2 4 6 8 10)
(list-of x (for x in (iota 10)) unless (evenp x))
=> (1 3 5 7 9)
Generators can be any ‘for’ clause understood by Iterate, including user-defined ones. We also provide an additional driver, ‘(for .. over ...)’, which allow iterating over any sequence.
Like a list comprehension but, instead of collecting the results, track and return the maximum.
Like a list comprehension but, instead of collecting the results, track and return the minimum.
Like a list comprehension but, as soon as any result is non-nil, stop evaluating and return ‘nil’ from the whole form.
Like a list comprehension but, instead of collecting the results into a list, multiply them together.
Like a list comprehension but, instead of collecting the results, sum them.
Like a list comprehension, but reduce the results using FN.
Jump to: | A C D E F G H L M N P R S |
---|
Jump to: | A C D E F G H L M N P R S |
---|
Jump to: | C F P S |
---|
Jump to: | C F P S |
---|