There are 30 utilities.
- bit-vector-integer v1.0
-
Convert a bit vector
bv
to a positive integer. The bits of the integer are ordered from most significant to least significant, unlessleast-significant-first
is true.- Provides
bit-vector-integer
- integer-bit-vector v1.0
-
Convert a positive integer
n
to a bit vector. The least significant bits will be first ifleast-significant-first
is true.- Provides
integer-bit-vector
- sort-copy v1.0
-
Copying versions of
cl:sort
andcl:stable-sort
.- Provides
sort-copy
,stable-sort-copy
- take v1.0
-
Take the first
n
elements fromsequence
.- Provides
take
- drop v1.0
-
Drop the first
n
elements fromsequence
.- Provides
drop
- subdivide v1.0
-
Split
sequence
into subsequences of sizechunk-size
.- Provides
subdivide
- n-grams v1.0
-
Find all
n
-grams of the sequencesequence
.- Provides
n-grams
- Requires
- take
- partition-if v1.0
-
Partition sequences based off of a predicate.
- Provides
partition-if
,partition-if-not
- equivalence-classes v1.0
-
Partition the sequence
seq
into a list of equivalence classes defined by the equivalence relationequiv
.- Provides
equivalence-classes
- doseq v1.0
-
Iterate across the sequence
seq
, binding the variablevar
to each element of the sequence and executingbody
. Return the valuereturn
from the iteration form.- Provides
doseq
- split-sequence v1.0
-
Split sequences into a list of subsequences based off of a delimiter or function.
- Provides
split-sequence
,split-sequence-if
,split-sequence-if-not
- sequence-of-length-p v1.0
-
- Provides
sequence-of-length-p
- Requires
- array-bounds
- rotate v1.0
-
Returns a sequence of the same type as
sequence
, with the elements ofsequence
rotated byn
:n
elements are moved from the end of the sequence to the front ifn
is positive, and-n
elements moved from the front to the end ifn
is negative.sequence
must be a proper sequence.n
must be an integer, defaulting to1
.If absolute value of
n
is greater then the length of the sequence, the results are identical to callingrotate
with(* (signum n) (mod n (length sequence))).
Note: the original sequence may be destructively altered, and result sequence may share structure with it.
- Provides
rotate
- Requires
- proper-list-length/last-car
- shuffle v1.0
-
Returns a random permutation of
sequence
bounded bystart
andend
. Original sequece may be destructively modified, and share storage with the original one. Signals an error ifsequence
is not a proper sequence.- Provides
shuffle
- Requires
- proper-list-length/last-car
- random-elt v1.0
-
Returns a random element from
sequence
bounded bystart
andend
. Signals an error if thesequence
is not a proper non-empty sequence, or ifend
andstart
are not proper bounding index designators forsequence
.- Provides
random-elt
- Requires
- proper-list-length/last-car
- removef v1.0
-
Modify-macro for
remove
. Sets place designated by the first argument to the result of callingremove
withitem
, place, and thekeyword-arguments
.- Provides
removef
- deletef v1.0
-
Modify-macro for
delete
. Sets place designated by the first argument to the result of callingdelete
withitem
, place, and thekeyword-arguments
.- Provides
deletef
- proper-sequence v1.0
-
Type designator for proper sequences, that is proper lists and sequences that are not lists.
- Provides
proper-sequence
- Requires
- proper-list
- length= v1.0
-
Takes any number of sequences or integers in any order. Returns true iff the length of all the sequences and the integers are equal.
Hint: there's a compiler macro that expands into more efficient code if the first argument is a literal integer.
- Provides
length=
- Requires
- with-gensyms, sequence-of-length-p, array-bounds
- copy-sequence v1.0
-
Returns a fresh sequence of
type
, which has the same elements assequence
.- Provides
copy-sequence
- first-elt v1.0
-
Getter and setter for the first element of a sequence.
- Provides
first-elt
- Requires
- emptyp
- last-elt v1.0
-
Getter and setter for the last element of a sequence.
- Provides
last-elt
- Requires
- proper-list-length/last-car, emptyp, proper-sequence
- starts-with-subseq v1.0
-
Test whether the first elements of SEQUENCE are the same (as per TEST) as the elements of PREFIX.
If RETURN-SUFFIX is T the functions returns, as a second value, a displaced array pointing to the sequence after PREFIX.
- Provides
starts-with-subseq
- Requires
- remove-from-plist
- ends-with-subseq v1.0
-
Test whether
sequence
ends withsuffix
. In other words: return true if the last(length suffix
) elements ofsequence
are equal tosuffix
.- Provides
ends-with-subseq
- starts-with v1.0
-
Returns true if
sequence
is a sequence whose first element iseql
toobject
. Returnsnil
if thesequence
is not a sequence or is an empty sequence.- Provides
starts-with
- ends-with v1.0
-
Returns true if
sequence
is a sequence whose last element iseql
toobject
. Returnsnil
if thesequence
is not a sequence or is an empty sequence. Signals an error ifsequence
is an improper list.- Provides
ends-with
- Requires
- proper-list-length/last-car
- map-combinations v1.0
-
Calls
function
with each combination oflength
constructable from the elements of the subsequence ofsequence
delimited bystart
andend
.start
defaults to0
,end
to length ofsequence
, andlength
to the length of the delimited subsequence. (So unlesslength
is specified there is only a single combination, which has the same elements as the delimited subsequence.) Ifcopy
is true (the default) each combination is freshly allocated. Ifcopy
is false all combinations areeq
to each other, in which case consequences are specified if a combination is modified byfunction
.- Provides
map-combinations
- Requires
- ensure-function
- map-permutations v1.0
-
Calls function with each permutation of
length
constructable from the subsequence ofsequence
delimited bystart
andend
.start
defaults to0
,end
to length of the sequence, andlength
to the length of the delimited subsequence.- Provides
map-permutations
- Requires
- map-combinations
- map-derangements v1.0
-
Calls
function
with each derangement of the subsequence ofsequence
denoted by the bounding index designatorsstart
andend
. Derangement is a permutation of the sequence where no element remains in place.sequence
is not modified, but individual derangements areeq
to each other. Consequences are unspecified if callingfunction
modifies either the derangement orsequence
.- Provides
map-derangements
- extremum v1.0
-
Returns the element of
sequence
that would appear first if the subsequence bounded bystart
andend
was sorted usingpredicate
andkey
.extremum
determines the relationship between two elements ofsequence
by using thepredicate
function.predicate
should return true if and only if the first argument is strictly less than the second one (in some appropriate sense). Two argumentsx
andy
are considered to be equal if(funcall predicate x y)
and(funcall predicate y x)
are both false.The arguments to the
predicate
function are computed from elements ofsequence
using thekey
function, if supplied. Ifkey
is not supplied or isnil
, the sequence element itself is used.If
sequence
is empty,nil
is returned.- Provides
extremum
- Requires
- ensure-function