Alphabetical documentation for all exported symbols in kutils.
kutils
alist-to-hash-table
(alist)
assoc-val
(item alist &rest key-args)
item
in alist
. key-args
should
contain any additional keyword arguments to assoc
.build-list
(arg)
build-vector
(arg)
arg
is an atom, return it as a list. If it's a list,
coerce it to a vector. If it's a vector, return the
vector. Otherwise, attempt to map it into a vector.cartprod2
(a b)
compose
(&rest fns)
condlet
(bindings &body forms)
bindings
in a let
form, then evaluate forms
in
a cond
.condlet*
(bindings &body forms)
bindings
in a let*
form, then evaluate forms
in
a cond
.copy-hash-table
(ht)
ht
.defmacro!
(name args &rest body)
drop
(n lst)
effector
(&rest fns)
effector
on its input. This is usually useful for
effectful code, such as logging.empty-or-nil-p
(arg)
arg
null, or does it represent an empty sequence? Returns
NIL if arg
is not a nil or a sequence.enable-hash-table-reader
nil
Enables the reader macro #{}#
for hash-tables. The resulting
hash-table will use #'equal
for equality. For example,
#{:a :b :c :d}#
will create a hash-table with the keys :a
and :c
; :a
stores the value :b
, and :c
stores the value :d
.
extend-vector
(v)
flatten
(x)
flip
(fn y)
fn
that takes arguments x
and y
, return a lambda with y
applied to the function.group
(source n)
hash-table-to-alist
(ht)
(key . value)
pairs.hashkeys
(ht)
iflet
(bindings &body (then &optional else))
bindings
in a let
form; if they are all T, execute
the then
form. Otherwise, execute the else
form.iflet*
(bindings &body (then &optional else))
bindings
in a let*
form; if they are all T, execute
the then
form. Otherwise, execute the else
form.in
(obj seq &key (test (function eql)) key deep)
Returns T if obj
, is in seq
.
If seq
is a list, test
is used to determine whether the object
matches. If key
is not NIL, it is applied to elements before
test
. If deep
is true, seq
will be flattened before
checking the list.
If seq
is a vector, test
is used to determine whether the
object matches. If key
is not NIL, it is applied to elements
before test
.
If seq
is a hash table, test
does not apply; the hash table's
test is used. If key
is not NIL, it is applied to obj
before
looking it up.
interpose
(x sep)
macroexpand-n
(n form)
mapv
(fn &rest vecs)
fn
over the vectors vecs
, producing a vector.mkkw
(&rest args)
mkstr
(&rest args)
mksymb
(&rest args)
new-hash-table
nil
#'equal
function as its test.new-vector
nil
orlet
(bindings &body body)
body
in a progn
.partial
(fn &rest initial-args)
partition
(pred seq)
seq
into a pair of sequences with pred
: the first of
the pair are those elements satisfying pred
, and the second are
those that do not satisfy pred
.sethash
(k v ht)
symb
(&rest args)
take
(n lst)
unlesslet
(bindings &body body)
body
in an implicit progn
.unlesslet*
(bindings &body body)
bindings
in a let*
form; if they are all not NIL,
evaluate body
, which is wrapped in an implicit progn
.whenlet
(bindings &body body)
body
in an implicit progn
.whenlet*
(bindings &body body)
bindings
in a let*
form; if they all evaluate to T,
evaluate body
, which is wrapped in an implicit progn
.with-gensyms
(syms &body body)
with-new-hash-table
(htsyms &body body)
htsyms
,
executing inside a let form, and returns the hash table(s). If only
one hash table is provided, return it as a single element; otherwise,
return an alist of the symbol names and hash tables.with-read-from-file
((stream path &rest args &key (direction input directionp) &allow-other-keys) &body body)
path
for reading, bound to stream
, with any remaining arguments
passed to with-open-file
, and execute body
.with-write-to-file
((stream path &rest args &key (direction output directionp) &allow-other-keys) &body body)
body
with the file at path
opened and bound to the
value of stream
. Any remaining keyword arguments are passed to
with-open-file
.zip
(&rest lsts)
* (zip '(a b c) '(1 2 3))
'((a 1)(b 2)(c 3)).
The following functions cannot be automatically documented by Codex,
as they are defined using the defmacro!
macro. Their description
is in the "Macro" section.
read-file-as-string
with-string-output-to-file
kutils-mop
list-all-slots
(class-sym &optional (package *package*))
make-instance-from-hash-table
(class-type table &optional (package *package*) snake-case)
snake-case
is t, the keys should use hyphens; otherwise, they
should use underscores. The slot type is used to determine whether
to attempt to parse another object as a hash table entry.kutils-system
path-as-string
(path)
path
, which can be either a string
or pathname
, return it as a string
.path-as-pathname
(path)
path
, which can be either a string
or pathname
, return it as a pathname
.extension-matches
(path ext)
t
if path
has the extensions ext
. It is intended to be used in building predicates.any-extension-matches
(path extensions)
T
if path
has any of the extensions provided.filter-extensions
(extensions path-list)
path-list
, remove with an extension contained in extensions
.select-extensions
(extensions path-list)
path-list
, return a list of all paths with extensions contained in extensions
.