Quickutilβ

Lisp utilities on demand

Fork me on GitHub
search

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, unless least-significant-first is true.

Provides
bit-vector-integer
Source Code
 
integer-bit-vector v1.0

Convert a positive integer n to a bit vector. The least significant bits will be first if least-significant-first is true.

Provides
integer-bit-vector
Source Code
 
sort-copy v1.0

Copying versions of cl:sort and cl:stable-sort.

Provides
sort-copystable-sort-copy
Source Code
 
take v1.0

Take the first n elements from sequence.

Provides
take
Source Code
 
drop v1.0

Drop the first n elements from sequence.

Provides
drop
Source Code
 
subdivide v1.0

Split sequence into subsequences of size chunk-size.

Provides
subdivide
Source Code
 
n-grams v1.0

Find all n-grams of the sequence sequence.

Provides
n-grams
Requires
take
Source Code
 
partition-if v1.0

Partition sequences based off of a predicate.

Provides
partition-ifpartition-if-not
Source Code
 
equivalence-classes v1.0

Partition the sequence seq into a list of equivalence classes defined by the equivalence relation equiv.

Provides
equivalence-classes
Source Code
 
doseq v1.0

Iterate across the sequence seq, binding the variable var to each element of the sequence and executing body. Return the value return from the iteration form.

Provides
doseq
Source Code
 
split-sequence v1.0

Split sequences into a list of subsequences based off of a delimiter or function.

Provides
split-sequencesplit-sequence-ifsplit-sequence-if-not
Source Code
 
sequence-of-length-p v1.0
Provides
sequence-of-length-p
Requires
array-bounds
Source Code
 
rotate v1.0

Returns a sequence of the same type as sequence, with the elements of sequence rotated by n: n elements are moved from the end of the sequence to the front if n is positive, and -n elements moved from the front to the end if n is negative. sequence must be a proper sequence. n must be an integer, defaulting to 1.

If absolute value of n is greater then the length of the sequence, the results are identical to calling rotate 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
Source Code
 
shuffle v1.0

Returns a random permutation of sequence bounded by start and end. Original sequece may be destructively modified, and share storage with the original one. Signals an error if sequence is not a proper sequence.

Provides
shuffle
Requires
proper-list-length/last-car
Source Code
 
random-elt v1.0

Returns a random element from sequence bounded by start and end. Signals an error if the sequence is not a proper non-empty sequence, or if end and start are not proper bounding index designators for sequence.

Provides
random-elt
Requires
proper-list-length/last-car
Source Code
 
removef v1.0

Modify-macro for remove. Sets place designated by the first argument to the result of calling remove with item, place, and the keyword-arguments.

Provides
removef
Source Code
 
deletef v1.0

Modify-macro for delete. Sets place designated by the first argument to the result of calling delete with item, place, and the keyword-arguments.

Provides
deletef
Source Code
 
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
Source Code
 
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
Source Code
 
copy-sequence v1.0

Returns a fresh sequence of type, which has the same elements as sequence.

Provides
copy-sequence
Source Code
 
first-elt v1.0

Getter and setter for the first element of a sequence.

Provides
first-elt
Requires
emptyp
Source Code
 
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
Source Code
 
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
Source Code
 
ends-with-subseq v1.0

Test whether sequence ends with suffix. In other words: return true if the last (length suffix) elements of sequence are equal to suffix.

Provides
ends-with-subseq
Source Code
 
starts-with v1.0

Returns true if sequence is a sequence whose first element is eql to object. Returns nil if the sequence is not a sequence or is an empty sequence.

Provides
starts-with
Source Code
 
ends-with v1.0

Returns true if sequence is a sequence whose last element is eql to object. Returns nil if the sequence is not a sequence or is an empty sequence. Signals an error if sequence is an improper list.

Provides
ends-with
Requires
proper-list-length/last-car
Source Code
 
map-combinations v1.0

Calls function with each combination of length constructable from the elements of the subsequence of sequence delimited by start and end. start defaults to 0, end to length of sequence, and length to the length of the delimited subsequence. (So unless length is specified there is only a single combination, which has the same elements as the delimited subsequence.) If copy is true (the default) each combination is freshly allocated. If copy is false all combinations are eq to each other, in which case consequences are specified if a combination is modified by function.

Provides
map-combinations
Requires
ensure-function
Source Code
 
map-permutations v1.0

Calls function with each permutation of length constructable from the subsequence of sequence delimited by start and end. start defaults to 0, end to length of the sequence, and length to the length of the delimited subsequence.

Provides
map-permutations
Requires
map-combinations
Source Code
 
map-derangements v1.0

Calls function with each derangement of the subsequence of sequence denoted by the bounding index designators start and end. Derangement is a permutation of the sequence where no element remains in place. sequence is not modified, but individual derangements are eq to each other. Consequences are unspecified if calling function modifies either the derangement or sequence.

Provides
map-derangements
Source Code
 
extremum v1.0

Returns the element of sequence that would appear first if the subsequence bounded by start and end was sorted using predicate and key.

extremum determines the relationship between two elements of sequence by using the predicate function. predicate should return true if and only if the first argument is strictly less than the second one (in some appropriate sense). Two arguments x and y 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 of sequence using the key function, if supplied. If key is not supplied or is nil, the sequence element itself is used.

If sequence is empty, nil is returned.

Provides
extremum
Requires
ensure-function
Source Code