| Title: | List-Processing à La 'SRFI-1' |
|---|---|
| Description: | Provides list-processing utilities inspired by the 'SRFI-1' list library for Scheme (<https://srfi.schemers.org/srfi-1/srfi-1.html>), including car/cdr family accessors, zip, pairwise, for.each, pair.fold.right and friends. Higher-order helpers that are orthogonal to list processing are deferred to the 'functional' package; this package is freely a mixture of implementation and API. |
| Authors: | Peter Danenberg [aut, cre] |
| Maintainer: | Peter Danenberg <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.2 |
| Built: | 2026-06-16 13:29:21 UTC |
| Source: | https://github.com/klutometis/r-lisp |
car/cdr
Composite car/cdr
caar(list)caar(list)
list |
the list from which to extract |
The extracted elements
car/cdr
Composite car/cdr
cadar(list)cadar(list)
list |
the list from which to extract |
The extracted elements
car/cdr
Composite car/cdr
caddr(list)caddr(list)
list |
the list from which to extract |
The extracted elements
car/cdr
Composite car/cdr
cadr(list)cadr(list)
list |
the list from which to extract |
The extracted elements
First element of a list
car(list)car(list)
list |
the list to first |
The first element
car/cdr
Composite car/cdr
cdddr(list)cdddr(list)
list |
the list from which to extract |
The extracted elements
car/cdr
Composite car/cdr
cddr(list)cddr(list)
list |
the list from which to extract |
The extracted elements
Return elements after the first of a list.
cdr(list)cdr(list)
list |
the list from which to extract |
The elements after the first, or nil if only one
cdrs; otherwise, return nil.Try to get the cdrs; otherwise, return nil.
cdrs(...)cdrs(...)
... |
lists to |
the cdr of the lists
f to the successive elements of ....Apply f to the successive elements of ....
for.each(f, ...)for.each(f, ...)
f |
the function to apply, whose arity should match
the cardinality of |
... |
lists upon which to apply |
NULL
Is a number even?
is.even(a)is.even(a)
a |
the number to test |
Whether the number is even
Whether a list is empty.
is.nil(list)is.nil(list)
list |
the list to test |
Whether the list is empty
Is a number odd?
is.odd(a)is.odd(a)
a |
the number to test |
Whether the number is odd
Last element in a list.
last(list)last(list)
list |
The list to last |
The last element of list.
pair-fold-right from SRFI-1.
pair.fold.right(f, nil, ...)pair.fold.right(f, nil, ...)
f |
function to apply over the list-tails |
nil |
the default value |
... |
the lists whose tails fold over |
The result of folding f over the successive tails (pairs) of
the input lists; nil if the lists are empty.
Combine a list into pairwise elements; lists should be of the same length. In case of odd numbers of members, the last will be removed.
pairwise(list)pairwise(list)
list |
the list to be pairwise decomposed |
A list of pairwise elements
Zip n lists together into tuplets of length n.
zip(zipper, ...)zip(zipper, ...)
zipper |
the zipping function |
... |
the lists to be zipped |
A list of tuplets
c.Zip using c.
zip.c(...)zip.c(...)
... |
the lists to be zipped |
A list of tuplets
list.Zip using list.
zip.list(...)zip.list(...)
... |
the lists to be zipped |
A list of tuplets
Do a less efficient zip whilst preserving names.
zip.with.names(...)zip.with.names(...)
... |
lists to be zipped whilst preserving names |
A list of tuples (one per position) with names preserved from the input lists.