The cl-lc Reference Manual

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.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-lc

List comprehensions

Author

Paul M. Rodriguez <>

License

MIT

Dependencies
  • alexandria (system).
  • optima (system).
  • iterate (system).
Source

cl-lc.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-lc/cl-lc.asd

Source

cl-lc.asd.

Parent Component

cl-lc (system).

ASDF Systems

cl-lc.


3.1.2 cl-lc/package.lisp

Source

cl-lc.asd.

Parent Component

cl-lc (system).

Packages

cl-lc.


3.1.3 cl-lc/cl-lc.lisp

Dependency

package.lisp (file).

Source

cl-lc.asd.

Parent Component

cl-lc (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-lc

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • iterate.
  • optima.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: all-of (exp &body exps)

Like a list comprehension but, as soon as any result is nil, stop evaluating and return ‘nil’ from the whole form.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: any-of (exp &body exps)

Like a list comprehension but, as soon as any result is non-nil, stop evaluating and return it from the whole form.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: count-of (exp &body exps)

Like a list comprehension but, instead of collecting the results, count them if they are non-nil.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: dict-of (exp &rest exps)

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.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: do-for ((&rest qs) &body head)

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.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: list-of (exp &body exps)

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.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: max-of (exp &body exps)

Like a list comprehension but, instead of collecting the results, track and return the maximum.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: min-of (exp &body exps)

Like a list comprehension but, instead of collecting the results, track and return the minimum.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: none-of (exp &body exps)

Like a list comprehension but, as soon as any result is non-nil, stop evaluating and return ‘nil’ from the whole form.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: product-of (exp &body exps)

Like a list comprehension but, instead of collecting the results into a list, multiply them together.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: sum-of (exp &body exps)

Like a list comprehension but, instead of collecting the results, sum them.

Package

cl-lc.

Source

cl-lc.lisp.


5.2 Internals


5.2.1 Macros

Macro: clause-for-over-1 (&key for over generate)
Package

cl-lc.

Source

cl-lc.lisp.

Macro: defcomp (name &rest accumulator)
Package

cl-lc.

Source

cl-lc.lisp.

Macro: lc (qs &optional accumulator)
Package

cl-lc.

Source

cl-lc.lisp.

Macro: reduction (fn expr &body exprs)

Like a list comprehension, but reduce the results using FN.

Package

cl-lc.

Source

cl-lc.lisp.

Macro: seq-dispatch (seq &body list)
Package

cl-lc.

Source

cl-lc.lisp.


5.2.2 Ordinary functions

Function: ensure-head (qs)
Package

cl-lc.

Source

cl-lc.lisp.

Function: generator? (exp)
Package

cl-lc.

Source

cl-lc.lisp.

Function: handle-inline-conditions (qs &optional acc)
Package

cl-lc.

Source

cl-lc.lisp.

Function: lcrec (head qualifiers accumulator outer)
Package

cl-lc.

Source

cl-lc.lisp.

Function: parse-generator (exp)
Package

cl-lc.

Source

cl-lc.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   C   D   E   F   G   H   L   M   N   P   R   S  
Index Entry  Section

A
all-of: Public macros
any-of: Public macros

C
clause-for-over-1: Private macros
count-of: Public macros

D
defcomp: Private macros
dict-of: Public macros
do-for: Public macros

E
ensure-head: Private ordinary functions

F
Function, ensure-head: Private ordinary functions
Function, generator?: Private ordinary functions
Function, handle-inline-conditions: Private ordinary functions
Function, lcrec: Private ordinary functions
Function, parse-generator: Private ordinary functions

G
generator?: Private ordinary functions

H
handle-inline-conditions: Private ordinary functions

L
lc: Private macros
lcrec: Private ordinary functions
list-of: Public macros

M
Macro, all-of: Public macros
Macro, any-of: Public macros
Macro, clause-for-over-1: Private macros
Macro, count-of: Public macros
Macro, defcomp: Private macros
Macro, dict-of: Public macros
Macro, do-for: Public macros
Macro, lc: Private macros
Macro, list-of: Public macros
Macro, max-of: Public macros
Macro, min-of: Public macros
Macro, none-of: Public macros
Macro, product-of: Public macros
Macro, reduction: Private macros
Macro, seq-dispatch: Private macros
Macro, sum-of: Public macros
max-of: Public macros
min-of: Public macros

N
none-of: Public macros

P
parse-generator: Private ordinary functions
product-of: Public macros

R
reduction: Private macros

S
seq-dispatch: Private macros
sum-of: Public macros


A.3 Variables