There are 43 utilities.
- positivep v1.0
-
Check if
n
is positive.- Provides
positivep
- negativep v1.0
-
Check if
n
is negative.- Provides
negativep
- non-negative-p v1.0
-
Check if
n
is non-negative.- Provides
non-negative-p
- non-positive-p v1.0
-
Check if
n
is non-positive.- Provides
non-positive-p
- non-zero-p v1.0
-
Check if
n
is non-zero.- Provides
non-zero-p
- digit-count v2.0
-
Compute the number of digits in the non-negative integer
n
in basebase
. By default, the base is 10.- Provides
digit-count
- range-product v1.0
-
Compute
lower * (lower+1) * ... * (upper-1) * upper
.- Provides
range-product
- factorial v1.0
-
Compute the factorial of
n
, wheren! = 1 * 2 * ... * n
.- Provides
factorial
- Requires
- range-product
- binomial-coefficient v1.0
-
Binomial coefficient of
n
andk
.- Provides
binomial-coefficient
- Requires
- factorial, range-product
- mulf v1.0
-
A modifying version of multiplication, similar to
incf
.- Provides
mulf
- divf v1.0
-
A modifying version of division, similar to
decf
.- Provides
divf
- half v1.0
-
Compute half of
x
.- Provides
half
- double v1.0
-
Compute double
x
.- Provides
double
- square v1.0
-
Compute the square of
x
.- Provides
square
- cube v1.0
-
Compute the cube of
x
.- Provides
cube
- digits v1.0
-
Return a list of the digits of the non-negative integer
n
in basebase
. By default, decimal digits are returned.The order of the digits is such that the
k
th element of the list refers to the coefficient ofbase^k
. In other words, given the resulting list(c0 c1 c2 ... ck)
the following identity holds:
n = c0 + c1*base + c2*base^2 + ... + ck*base^k.
- Provides
digits
- nth-digit v1.0
-
Get the
n
th digit in a rational numbernumber
in basebase
. Ifn
is positive, it refers to digits to the left of the decimal point, and if negative, to the right. The digits of a negative number match that of its positive counterpart.- Provides
nth-digit
- 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
- primes-below v1.0
-
Return a sorted list of all primes below an integer
n
.Examples:
(primes-below 13) => (2 3 5 7 11) (primes-below -1) => NIL
- Provides
primes-below
- sec v1.0
-
Compute the secant of a number
z
.- Provides
sec
- csc v1.0
-
Compute the cosecant of a number
z
.- Provides
csc
- cot v1.0
-
Compute the cotangent of a number
z
.- Provides
cot
- asec v1.0
-
Compute the arcsecant of a number
z
.- Provides
asec
- acsc v1.0
-
Compute the arccosecant of a number
z
.- Provides
acsc
- acot v1.0
-
Compute the arccotangent of a number
z
.- Provides
acot
- imaginary-i v1.0
-
The imaginary number
i = sqrt(-1)
.- Provides
imaginary-i
,ii
- exponential-e v1.0
-
The exponential number
e = 2.71828...
.- Provides
exponential-e
,ee
- 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
- clamp v1.0
-
Clamps the
number
into [min
,max
] range. Returnsmin
ifnumber
is lesser thenmin
andmax
ifnumber
is greater thenmax
, otherwise returnsnumber
.- Provides
clamp
- gaussian-random v1.0
-
Returns two gaussian random double floats as the primary and secondary value, optionally constrained by
min
andmax
. Gaussian random numbers form a standard normal distribution around0.0d0
.Sufficiently positive
min
or negativemax
will cause the algorithm used to take a very long time. Ifmin
is positive it should be close to zero, and similarly ifmax
is negative it should be close to zero.- Provides
gaussian-random
- lerp v1.0
-
Returns the result of linear interpolation between
a
andb
, using the interpolation coefficientv
.- Provides
lerp
- mean v1.0
-
Returns the mean of
sample
.sample
must be a sequence of numbers.- Provides
mean
- median v1.0
-
Returns median of
sample
.sample
must be a sequence of real numbers.- Provides
median
- Requires
- copy-sequence
- variance v1.0
-
Variance of
sample
. Returns the biased variance ifbiased
is true (the default), and the unbiased estimator of variance ifbiased
is false.sample
must be a sequence of numbers.- Provides
variance
- Requires
- mean
- standard-deviation v1.0
-
Standard deviation of
sample
. Returns the biased standard deviation ifbiased
is true (the default), and the square root of the unbiased estimator for variance ifbiased
is false (which is not the same as the unbiased estimator for standard deviation).sample
must be a sequence of numbers.- Provides
standard-deviation
- Requires
- variance
- maxf v1.0
-
Modify-macro for
max
. Sets place designated by the first argument to the maximum of its original value andnumbers
.- Provides
maxf
- minf v1.0
-
Modify-macro for
min
. Sets place designated by the first argument to the minimum of its original value andnumbers
.- Provides
minf
- subfactorial v1.0
-
Subfactorial of the non-negative integer
n
.- Provides
subfactorial
- count-permutations v1.0
-
Number of
k
element permutations for a sequence ofn
objects.k
defaults ton
- Provides
count-permutations
- Requires
- range-product