There are 54 utilities.
- range v1.0
-
Return the list of numbers
n
such thatstart <= n < end
andn = start + k*step
for suitable integersk
. If a functionkey
is provided, then apply it to each number.- Provides
range
- replicate v1.0
-
Make a list of
n
copies ofx
.- Provides
replicate
- slice v1.0
-
Compute the slice of a list
list
at indexesindexes
.- Provides
slice
- transpose v1.0
-
Analog to matrix transpose for a list of lists given by
lists
.- Provides
transpose
- zip v1.0
-
Take a tuple of lists and turn them into a list of tuples. Equivalent to
unzip
.- Provides
zip
- Requires
- transpose
- unzip v1.0
-
Take a list of tuples and return a tuple of lists. Equivalent to
zip
.- Provides
unzip
- Requires
- transpose
- long-zip v1.0
-
zip
using the longest, rather than shortest list, filling withfill
.- Provides
long-zip
- Requires
- zip
- enumerate v1.0
-
Equivalent to
(zip (iota (length list)) list)
.- Provides
enumerate
- flatten-once v1.0
-
Flatten
list
once.- Provides
flatten-once
- flatten-tagged-once v1.0
-
Flatten once a list
x
with a tagtag
.- Provides
flatten-tagged-once
- flatten v1.0
-
Flatten (and append) all lists
xs
completely.- Provides
flatten
- ncycle v1.0
-
Mutate
list
into a circlular list.- Provides
ncycle
- cycle v1.0
-
Make
list
into a circular list.- Provides
cycle
- Requires
- ncycle
- nest v1.0
-
Compute a
count
compositions offunction
oninitial-value
.- Provides
nest
- nest-list v1.0
-
Compute a list of
count
compositions offunction
oninitial-value
.- Provides
nest-list
- safe-nth v1.0
-
Find the
n
th element oflist
. Ifn
is out of bounds, returnif-out-of-bounds
(nil
by default).- Provides
safe-nth
- mapply v1.0
-
Apply
f
to each list of arguments contained withinlist
and collect the results.- Provides
mapply
- cartesian-product v1.0
-
Compute the cartesian product of
l1
andl2
as if they were sets. Optionally, map the functionf
across the product.- Provides
cartesian-product
- end v1.0
-
Return the last element of
list
and whether or not it was empty.- Provides
end
- tabulate v1.0
-
Return a list evaluations of
f
over the integers[0,n)
. Mimics the SML function of the same name.- Provides
tabulate
- Requires
- range
- collect-reduce v1.0
-
Collects intermediate reduction results of applying
f
tolist
. More or less equivalent to(loop :for i :in list :collect (reduce f i))
.- Provides
collect-reduce
- weave v1.0
-
Return a list whose elements alternate between each of the lists
lists
. Weaving stops when any of the lists has been exhausted.- Provides
weave
- interleave v1.0
-
Return a list whose elements alternate between each of the lists
lists
. When a list has been exhausted, interleaving continues with whatever other non-empty lists.- Provides
interleave
- riffle v1.0
-
Insert the item
obj
in between each element oflist
.- Provides
riffle
- extend v1.0
-
Adjoin
x
to the end ofxs
.- Provides
extend
- list-to-vector v1.0
-
Convert
list
into a vector.- Provides
list-to-vector
- sequence-to-list v1.0
-
Convert the sequence
seq
into a list.- Provides
sequence-to-list
- explode v1.0
-
The classic
explode
function. Take a string and return a list of its characters.- Provides
explode
- Requires
- sequence-to-list
- implode v1.0
-
The classic
implode
function. Take a list of characters and return the corresponding string.- Provides
implode
- Requires
- list-to-vector
- inits v1.0
-
Generate a list of initial sublists of the list
list
. The nameinits
comes from the Haskell function of the same name.Example:
> (inits '(a b c d)) (NIL (A) (A B) (A B C) (A B C D))
- Provides
inits
- tails v1.0
-
Generate a list of tails of the list
list
. The nametails
comes from the Haskell function of the same name.Example
> (tails '(a b c d)) ((A B C D) (B C D) (C D) (D) NIL)
- Provides
tails
- array-contents v1.0
-
Extract the contents of the array
array
, returning a value that would be suitable to pass to the:initial-contents
keyword argument ofmake-array
.- Provides
array-contents
- alist-plist v1.0
-
Convert between alists and plists.
- Provides
alist-plist
,plist-alist
- Requires
- safe-endp
- assoc-value v1.0
-
Getters and setters for
assoc
andrassoc
values.- Provides
assoc-value
,rassoc-value
- Requires
- with-gensyms
- doplist v1.0
-
Iterates over elements of
plist
.body
can be preceded by declarations, and is like atagbody
.return
may be used to terminate the iteration early. Ifreturn
is not used, returnsvalues
.- Provides
doplist
- Requires
- parse-body, with-gensyms
- appendf v1.0
-
Modify-macro for
append
. Appendslists
to the place designated by the first argument.- Provides
appendf
- nconcf v1.0
-
Modify-macro for
nconc
. Concatenateslists
to place designated by the first argument.- Provides
nconcf
- unionf v1.0
-
Modify-macro for
union
. Saves the union oflist
and the contents of the place designated by the first argument to the designated place.- Provides
unionf
- nunionf v1.0
-
Modify-macro for
nunion
. Saves the union oflist
and the contents of the place designated by the first argument to the designated place. May modify either argument.- Provides
nunionf
- reversef v1.0
-
Modify-macro for
reverse
. Copies and reverses the list stored in the given place and saves back the result into the place.- Provides
reversef
- nreversef v1.0
-
Modify-macro for
nreverse
. Reverses the list stored in the given place by destructively modifying it and saves back the result into the place.- Provides
nreversef
- circular-list v1.0
-
Creation and detection of circular lists.
- Provides
circular-list
,circular-list-p
,make-circular-list
- proper-list-p v1.0
-
Returns true if
object
is a proper list.- Provides
proper-list-p
- proper-list v1.0
-
Type designator for proper lists. Implemented as a
satisfies
type, hence not recommended for performance intensive use. Main usefulness as a type designator of the expected type in atype-error
.- Provides
proper-list
- Requires
- proper-list-p
- proper-list-length/last-car v1.0
-
Compute the length of a proper list, and the last CAR of a list quickly.
- Provides
proper-list-length
,last-car
- Requires
- circular-list, safe-endp
- ensure-car v1.0
-
If
thing
is acons
, itscar
is returned. Otherwisething
is returned.- Provides
ensure-car
- ensure-cons v1.0
-
If
cons
is a cons, it is returned. Otherwise returns a fresh cons withcons
in the car, andnil
in the cdr.- Provides
ensure-cons
- ensure-list v1.0
-
If
list
is a list, it is returned. Otherwise returns the list designated bylist
.- Provides
ensure-list
- remove-from-plist v1.0
-
Destructive and non-destructive functions to remove items from a plist, as well as associated modify macros.
- Provides
remove-from-plist
,delete-from-plist
,remove-from-plistf
,delete-from-plistf
,sans
- mappend v1.0
-
Applies
function
to respective element(s) of eachlist
, appending all the all the result list to a single list.function
must return a list.- Provides
mappend
- setp v1.0
-
Returns true if
object
is a list that denotes a set,nil
otherwise. A list denotes a set if each element of the list is unique underkey
andtest
.- Provides
setp
- set-equal v1.0
-
Returns true if every element of
list1
matches some element oflist2
and every element oflist2
matches some element oflist1
. Otherwise returns false.- Provides
set-equal
- map-product v1.0
-
Returns a list containing the results of calling
function
with one argument fromlist
, and one from each ofmore-lists
for each combination of arguments. In other words, returns the product oflist
andmore-lists
usingfunction
.Example:
(map-product 'list '(1 2) '(3 4) '(5 6)) => ((1 3 5) (1 3 6) (1 4 5) (1 4 6) (2 3 5) (2 3 6) (2 4 5) (2 4 6))
- Provides
map-product
- Requires
- ensure-function, curry, mappend
- iota v1.0
-
Return a list of
n
numbers, starting fromstart
(with numeric contagion fromstep
applied), each consequtive number being the sum of the previous one andstep
.start
defaults to0
andstep
to1
.Examples:
(iota 4) => (0 1 2 3) (iota 3 :start 1 :step 1.0) => (1.0 2.0 3.0) (iota 3 :start -1 :step -1/2) => (-1 -3/2 -2)
- Provides
iota