This is the serapeum Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:40:49 2024 GMT+0.
serapeum/serapeum.asd
serapeum/package.lisp
serapeum/portability.lisp
serapeum/macro-tools.lisp
serapeum/level0/types.lisp
serapeum/level0/definitions.lisp
serapeum/level0/defining-types.lisp
serapeum/level0/binding.lisp
serapeum/level0/control-flow.lisp
serapeum/level0/threads.lisp
serapeum/level0/iter.lisp
serapeum/level0/conditions.lisp
serapeum/level0/op.lisp
serapeum/level0/functions.lisp
serapeum/level0/trees.lisp
serapeum/level0/hash-tables.lisp
serapeum/level0/files.lisp
serapeum/level0/symbols.lisp
serapeum/level0/arrays.lisp
serapeum/level0/queue.lisp
serapeum/level0/box.lisp
serapeum/level0/numbers.lisp
serapeum/level0/octets.lisp
serapeum/level0/time.lisp
serapeum/level0/clos.lisp
serapeum/level0/hooks.lisp
serapeum/level0/fbind.lisp
serapeum/level0/static-let.lisp
serapeum/level0/reader.lisp
serapeum/level0/packages.lisp
serapeum/level0/heap.lisp
serapeum/level1/lists.lisp
serapeum/level1/sequences.lisp
serapeum/level1/strings.lisp
serapeum/level1/vectors.lisp
serapeum/level2/exporting.lisp
serapeum/level2/vector=.lisp
serapeum/level2/mop.lisp
serapeum/level2/internal-definitions.lisp
serapeum/level2/tree-case.lisp
serapeum/level2/dispatch-case.lisp
serapeum/level2/range.lisp
serapeum/level2/generalized-arrays.lisp
serapeum/level2/units.lisp
serapeum/contrib/hooks.lisp
serapeum/static-let
serapeum.exporting
serapeum/bundle
serapeum/vector=
serapeum
serapeum.sum
serapeum/op
serapeum/dispatch-case
serapeum/generalized-arrays
serapeum-user
serapeum.unlocked
serapeum/contrib/hooks
serapeum/internal-definitions
serapeum/mop
The main system appears first, followed by any subsystem dependency.
serapeum
Utilities beyond Alexandria.
Paul M. Rodriguez <pmr@ruricolist.com>
MIT
extensible-sequences
(system)., required, for feature :abcl
alexandria
(system).
trivia
(system).
split-sequence
(system).
string-case
(system).
parse-number
(system).
trivial-garbage
(system).
bordeaux-threads
(system).
parse-declarations-1.0
(system).
introspect-environment
(system).
trivial-cltl2
(system).
global-vars
(system).
trivial-file-size
(system).
trivial-macroexpand-all
(system).
package.lisp
(file).
portability.lisp
(file).
macro-tools.lisp
(file).
level0
(module).
level1
(module).
level2
(module).
contrib
(module).
Modules are listed depth-first from the system components tree.
serapeum/level0
macro-tools.lisp
(file).
serapeum
(system).
types.lisp
(file).
definitions.lisp
(file).
defining-types.lisp
(file).
binding.lisp
(file).
control-flow.lisp
(file).
threads.lisp
(file).
iter.lisp
(file).
conditions.lisp
(file).
op.lisp
(file).
functions.lisp
(file).
trees.lisp
(file).
hash-tables.lisp
(file).
files.lisp
(file).
symbols.lisp
(file).
arrays.lisp
(file).
queue.lisp
(file).
box.lisp
(file).
numbers.lisp
(file).
octets.lisp
(file).
time.lisp
(file).
clos.lisp
(file).
hooks.lisp
(file).
fbind.lisp
(file).
static-let.lisp
(file).
reader.lisp
(file).
packages.lisp
(file).
heap.lisp
(file).
serapeum/level1
level0
(module).
serapeum
(system).
lists.lisp
(file).
sequences.lisp
(file).
strings.lisp
(file).
vectors.lisp
(file).
serapeum/level2
level1
(module).
serapeum
(system).
exporting.lisp
(file).
vector=.lisp
(file).
mop.lisp
(file).
internal-definitions.lisp
(file).
tree-case.lisp
(file).
dispatch-case.lisp
(file).
range.lisp
(file).
generalized-arrays.lisp
(file).
units.lisp
(file).
serapeum/contrib
level2
(module).
serapeum
(system).
hooks.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
serapeum/serapeum.asd
serapeum/package.lisp
serapeum/portability.lisp
serapeum/macro-tools.lisp
serapeum/level0/types.lisp
serapeum/level0/definitions.lisp
serapeum/level0/defining-types.lisp
serapeum/level0/binding.lisp
serapeum/level0/control-flow.lisp
serapeum/level0/threads.lisp
serapeum/level0/iter.lisp
serapeum/level0/conditions.lisp
serapeum/level0/op.lisp
serapeum/level0/functions.lisp
serapeum/level0/trees.lisp
serapeum/level0/hash-tables.lisp
serapeum/level0/files.lisp
serapeum/level0/symbols.lisp
serapeum/level0/arrays.lisp
serapeum/level0/queue.lisp
serapeum/level0/box.lisp
serapeum/level0/numbers.lisp
serapeum/level0/octets.lisp
serapeum/level0/time.lisp
serapeum/level0/clos.lisp
serapeum/level0/hooks.lisp
serapeum/level0/fbind.lisp
serapeum/level0/static-let.lisp
serapeum/level0/reader.lisp
serapeum/level0/packages.lisp
serapeum/level0/heap.lisp
serapeum/level1/lists.lisp
serapeum/level1/sequences.lisp
serapeum/level1/strings.lisp
serapeum/level1/vectors.lisp
serapeum/level2/exporting.lisp
serapeum/level2/vector=.lisp
serapeum/level2/mop.lisp
serapeum/level2/internal-definitions.lisp
serapeum/level2/tree-case.lisp
serapeum/level2/dispatch-case.lisp
serapeum/level2/range.lisp
serapeum/level2/generalized-arrays.lisp
serapeum/level2/units.lisp
serapeum/contrib/hooks.lisp
serapeum/portability.lisp
package.lisp
(file).
serapeum
(system).
no-applicable-method-error
(type).
static-load-time-value
(macro).
static-load-time-value-error
(condition).
call-with-array-data/copy
(function).
call-with-array-data/fast
(function).
test-load-time-value
(compiler macro).
test-load-time-value
(function).
with-simple-vector
(macro).
serapeum/macro-tools.lisp
portability.lisp
(file).
serapeum
(system).
+merge-tail-calls+
(constant).
callf
(macro).
callf2
(macro).
case-failure
(function).
case-failure
(condition).
define-case-macro
(macro).
define-do-macro
(macro).
define-post-modify-macro
(macro).
eval-if-constant
(function).
expand-macro
(function).
expand-macro-recursively
(function).
expect-form-list
(function).
expect-single-form
(function).
parse-leading-keywords
(function).
partition-declarations
(function).
string-gensym
(function).
unique-name
(function).
unparse-ordinary-lambda-list
(function).
unsplice
(function).
with-read-only-vars
(macro).
with-thunk
(macro).
(setf %read-only-var)
(function).
*case-macro-target*
(special variable).
*forbidden-heads*
(special variable).
clauses+default
(function).
declaim-maybe-inline
(macro).
declaim-maybe-inline-1
(macro).
ensuring-functions
(macro).
expand-case-macro
(function).
expand-case-macro/common
(function).
expand-case-macro/flet
(function).
expand-case-macro/tagbody
(function).
expand-read-only-var
(function).
extract-function-name
(function).
lambda-list-vars
(function).
make-unique-name-list
(function).
normalize-cases
(function).
parse-defmethod-args
(function).
policy-quality
(function).
policy>
(function).
read-only-var
(macro).
(setf read-only-var)
(setf expander).
rebinding-functions
(macro).
seq-dispatch
(macro).
simplify-keylists
(function).
speed-matters?
(function).
variable-special?
(function).
variable-type
(function).
vector-dispatch
(macro).
serapeum/level0/types.lisp
level0
(module).
*boolean-bypass*
(special variable).
->
(macro).
->
(type).
assure
(macro).
assure
(type).
assuref
(macro).
boolean-if
(macro).
boolean-unless
(macro).
boolean-when
(macro).
input-stream
(type).
nor
(type).
octet
(type).
octet-vector
(type).
output-stream
(type).
proper-subtype-p
(function).
proper-supertype-p
(function).
soft-alist-of
(type).
soft-list-of
(type).
supertypep
(function).
true
(compiler macro).
true
(function).
true
(type).
tuple
(type).
vref
(macro).
wholenum
(type).
with-boolean
(macro).
with-item-key-function
(macro).
with-member-test
(macro).
with-simple-vector-dispatch
(macro).
with-string-dispatch
(macro).
with-subtype-dispatch
(macro).
with-two-arg-test
(macro).
with-type-dispatch
(macro).
with-vector-dispatch
(macro).
%all-branches%
(symbol macro).
%in-branching%
(symbol macro).
%require-type
(function).
%require-type-for
(function).
%with-boolean
(macro).
*soft-list-cutoff*
(special variable).
*vref-by-type*
(special variable).
assure-values
(macro).
conditional-error
(function).
declaim-constant-function
(macro).
declaim-freeze-type
(macro).
declaim-freeze-type-1
(macro).
false
(type).
missing-branch
(function).
policy-quality-in-env
(macro).
proper-alist?
(function).
proper-list-without-nil?
(function).
proper-list?
(function).
read-new-value
(function).
remove-duplicated-subtypes
(function).
remove-shadowed-subtypes
(function).
require-type
(compiler macro).
require-type
(function).
require-type-for
(compiler macro).
require-type-for
(function).
simplify-subtypes
(function).
sort-subtypes
(function).
subtypes-exhaustive?
(function).
truly-the
(macro).
type-vref
(function).
variable-type-in-env
(macro).
with-nullable
(macro).
with-type-declarations-trusted
(macro).
with-vref
(macro).
wrong-type
(macro).
serapeum/level0/definitions.lisp
iter.lisp
(file).
defining-types.lisp
(file).
level0
(module).
def
(macro).
defalias
(macro).
defconst
(macro).
define-values
(macro).
defloop
(macro).
defparameter-unbound
(macro).
defplace
(macro).
defsubst
(macro).
defvar-unbound
(macro).
make-load-form
(method).
mvdef
(macro).
read-only-struct-slot-names
(method).
same-literal-p
(function).
unbound
(function).
unbound
(structure).
unbound-p
(function).
unbound-var
(reader).
serapeum/level0/defining-types.lisp
iter.lisp
(file).
level0
(module).
%union
(symbol macro).
deconstruct
(function).
defcondition
(macro).
defconstructor
(macro).
defstruct-read-only
(macro).
defunion
(macro).
defunit
(macro).
make-load-form
(method).
match-of
(macro).
read-eval-prefix
(function).
%constructor=
(generic function).
%read-only-struct
(structure).
%unit
(structure).
*units*
(special variable).
check-match-exhaustive
(function).
constructor-values/generic
(generic function).
constructor=
(function).
env-super
(function).
include+opts
(function).
intern-unit
(function).
pattern-type
(function).
print-constructor
(function).
print-unit
(function).
quote-unless-constant
(function).
read-only-include-clause
(function).
read-only-slotdef
(function).
read-only-struct-slot-names
(generic function).
serapeum/level0/binding.lisp
level0
(module).
canonicalize-bindings
(function).
firstn-values
(macro).
flet*
(macro).
let1
(macro).
letrec-with
(macro).
lret-aux
(macro).
simple-binding-p
(function).
stack-flet
(macro).
serapeum/level0/control-flow.lisp
definitions.lisp
(file).
level0
(module).
bcond
(macro).
case-let
(macro).
case-of
(macro).
case-using
(macro).
ccase-let
(macro).
ccase-of
(macro).
comment
(macro).
cond-every
(macro).
cond-let
(macro).
ctypecase-let
(macro).
ctypecase-of
(macro).
destructuring-case-of
(macro).
destructuring-ccase-of
(macro).
destructuring-ecase-of
(macro).
ecase-let
(macro).
ecase-of
(macro).
ecase-using
(macro).
econd
(macro).
econd-failure
(condition).
econd-let
(macro).
eif
(macro).
eif-let
(macro).
ensure
(macro).
(setf ensure)
(setf expander).
ensure2
(macro).
(setf ensure2)
(setf expander).
eq*
(compiler macro).
eq*
(function).
eql*
(compiler macro).
eql*
(function).
equal*
(compiler macro).
equal*
(function).
equalp*
(compiler macro).
equalp*
(function).
etypecase-let
(macro).
etypecase-of
(macro).
eval-always
(macro).
eval-and-compile
(macro).
example
(macro).
nand
(macro).
nest
(macro).
nix
(macro).
no
(compiler macro).
no
(function).
nor
(macro).
null-if
(function).
recursion-forbidden
(condition).
select
(macro).
selector
(macro).
sort-values
(macro).
string-case
(macro).
string-ecase
(macro).
typecase-let
(macro).
typecase-of
(macro).
without-recursion
(macro).
~>
(macro).
~>>
(macro).
*recursions*
(special variable).
case-using-aux
(macro).
check-exhaustiveness
(function).
check-no-underscores
(function).
define-variadic-equality
(macro).
describe-non-exhaustive-match
(function).
expand-destructuring-case-of
(function).
expand-nest
(function).
expand-variadic-equality
(function).
explode-type
(function).
if-let1
(macro).
nix-1
(macro).
same-type?
(function).
sort-values/network
(macro).
sort-values/temp-vector
(macro).
sorting-network
(function).
sorting-networks
(symbol macro).
string-case-failure
(function).
thread-aux
(function).
serapeum/level0/threads.lisp
level0
(module).
count-cpus
(function).
monitor
(generic function).
synchronized
(macro).
synchronized
(class).
*monitors*
(special variable).
count-cpus-string
(function).
ensure-monitor
(function).
lock-form
(function).
serapeum/level0/iter.lisp
level0
(module).
collecting
(macro).
nlet
(macro).
summing
(macro).
with-collector
(macro).
with-collectors
(macro).
collecting*
(macro).
with-current-package-symbols
(macro).
serapeum/level0/conditions.lisp
level0
(module).
ignoring
(macro).
maybe-invoke-restart
(function).
serapeum/level0/op.lisp
level0
(module).
body+vars
(function).
extract-op-env
(function).
free?
(function).
make-op-env
(function).
numbered-placeholder?
(function).
op-env
(class).
op-env-lambda
(method).
op/no-walker
(macro).
placeholder?
(function).
quotation?
(function).
rest-arg
(symbol macro).
rest-op?
(function).
rest-placeholder?
(function).
sym-numbered-placeholder?
(function).
sym-rest-arg?
(function).
sym-underscore?
(function).
underscore
(symbol macro).
var-lexical?
(function).
serapeum/level0/functions.lisp
types.lisp
(file).
iter.lisp
(file).
level0
(module).
capped-fork
(compiler macro).
capped-fork
(function).
capped-fork2
(compiler macro).
capped-fork2
(function).
define-train
(macro).
distinct
(function).
do-nothing
(compiler macro).
do-nothing
(function).
dynamic-closure
(function).
eqls
(compiler macro).
eqls
(function).
eqs
(compiler macro).
eqs
(function).
equals
(compiler macro).
equals
(function).
flip
(compiler macro).
flip
(function).
fnil
(compiler macro).
fnil
(function).
fork
(compiler macro).
fork
(function).
fork2
(compiler macro).
fork2
(function).
fuel
(function).
hook
(compiler macro).
hook
(function).
hook2
(compiler macro).
hook2
(function).
juxt
(compiler macro).
juxt
(function).
mvconstantly
(compiler macro).
mvconstantly
(function).
nth-arg
(compiler macro).
nth-arg
(function).
once
(compiler macro).
once
(function).
partial
(compiler macro).
partial
(function).
repeat-until-stable
(function).
throttle
(function).
trampoline
(function).
unary->variadic
(compiler macro).
unary->variadic
(function).
variadic->unary
(compiler macro).
variadic->unary
(function).
+alist-breakeven+
(symbol macro).
+storage-for-deflex-var-+alist-breakeven++
(constant).
serapeum/level0/trees.lisp
level0
(module).
map-tree/inorder
(function).
map-tree/postorder
(function).
map-tree/preorder
(function).
serapeum/level0/hash-tables.lisp
iter.lisp
(file).
types.lisp
(file).
control-flow.lisp
(file).
binding.lisp
(file).
level0
(module).
@
(compiler macro).
(setf @)
(compiler macro).
@
(function).
(setf @)
(function).
delete-from-hash-table
(function).
dict
(compiler macro).
dict
(function).
dict*
(function).
dictq
(macro).
do-hash-table
(macro).
flip-hash-table
(function).
hash-fold
(function).
hash-table-function
(function).
hash-table-predicate
(function).
hash-table-set
(function).
hash-table-test-p
(function).
href
(compiler macro).
(setf href)
(compiler macro).
href
(function).
(setf href)
(function).
href-default
(function).
make-hash-table-function
(function).
maphash-into
(function).
maphash-new
(function).
maphash-return
(function).
merge-tables
(function).
pairhash
(function).
pophash
(function).
pretty-print-hash-table
(function).
set-hash-table
(function).
swaphash
(function).
toggle-pretty-print-hash-table
(function).
+hash-table-default-size+
(constant).
check-same-test
(function).
copy-hash-table/empty
(function).
expand-href
(function).
merge-tables!
(function).
same-test?
(function).
serapeum/level0/files.lisp
types.lisp
(file).
level0
(module).
absolute-directory-pathname
(type).
absolute-pathname
(type).
base-path-join
(function).
directory-pathname
(type).
exe
(function).
file-pathname
(type).
file-size
(function).
file-size-human-readable
(function).
file=
(function).
format-file-size-human-readable
(function).
non-wild-pathname
(type).
path-basename
(function).
path-join
(function).
relative-pathname
(type).
resolve-executable
(function).
wild-pathname
(type).
with-open-files
(macro).
write-file-into-stream
(function).
write-stream-into-file
(function).
$path
(function).
+pathsep+
(constant).
file=/loop
(function).
physical-pathname
(type).
serapeum/level0/symbols.lisp
level0
(module).
bound-value
(function).
(setf bound-value)
(function).
find-keyword
(function).
serapeum/level0/arrays.lisp
level0
(module).
array-index-row-major
(function).
undisplace-array
(function).
serapeum/level0/queue.lisp
types.lisp
(file).
level0
(module).
clear-queue
(function).
copy-queue
(function).
deq
(function).
enq
(function).
front
(function).
(setf front)
(function).
make-load-form
(method).
print-object
(method).
qappend
(function).
qback
(function).
(setf qback)
(function).
qconc
(function).
qlen
(function).
qlist
(function).
qpreconc
(function).
qprepend
(function).
queue
(compiler macro).
queue
(function).
queue
(structure).
queue-empty-p
(function).
queuep
(function).
undeq
(function).
make-queue
(function).
make-queue-cons
(function).
queue-cons
(reader).
serapeum/level0/box.lisp
types.lisp
(file).
definitions.lisp
(file).
level0
(module).
box
(function).
box
(structure).
make-load-form
(method).
print-object
(method).
unbox
(reader).
(setf unbox)
(writer).
+atomic-accessors+
(constant).
boxp
(function).
copy-box
(function).
serapeum/level0/numbers.lisp
types.lisp
(file).
op.lisp
(file).
level0
(module).
bits
(function).
fdec
(macro).
finc
(macro).
fixnump
(function).
float-precision-contagion
(function).
grow
(function).
growf
(macro).
null-if-zero
(function).
parse-float
(compiler macro).
parse-float
(function).
random-in-range
(compiler macro).
random-in-range
(function).
round-to
(function).
shrink
(function).
shrinkf
(macro).
unbits
(function).
exponent-char-format
(function).
exponent-char?
(function).
make-float
(function).
random-range-type
(function).
read-float
(function).
read-float-aux
(function).
serapeum/level0/octets.lisp
types.lisp
(file).
level0
(module).
make-octet-vector
(function).
octet-vector
(compiler macro).
octet-vector
(function).
octet-vector-p
(function).
octet-vector=
(function).
octets
(function).
unoctets
(function).
octet-vector=/unsafe
(function).
serapeum/level0/time.lisp
level0
(module).
date-leap-year-p
(function).
get-unix-time
(function).
interval
(compiler macro).
interval
(function).
time-since
(function).
time-until
(function).
universal-to-unix
(function).
unix-to-universal
(function).
+seconds-in-day+
(constant).
+seconds-in-hour+
(constant).
+unix-epoch+
(constant).
serapeum/level0/clos.lisp
binding.lisp
(file).
types.lisp
(file).
level0
(module).
class-name-of
(function).
class-name-safe
(function).
defmethods
(macro).
find-class-safe
(function).
make
(compiler macro).
make
(function).
(setf slot-value-safe)
(setf expander).
slot-value-safe
(function).
subclass-union
(type).
object
(type).
struct-to-try-instantiating
(structure).
serapeum/level0/hooks.lisp
threads.lisp
(file).
level0
(module).
*hook*
(special variable).
add-hook
(generic function).
remove-hook
(generic function).
run-hook
(generic function).
run-hook-until-failure
(generic function).
run-hook-until-success
(generic function).
run-hooks
(function).
with-hook-restart
(macro).
serapeum/level0/fbind.lisp
binding.lisp
(file).
control-flow.lisp
(file).
op.lisp
(file).
iter.lisp
(file).
trees.lisp
(file).
level0
(module).
fbind
(macro).
fbind*
(macro).
fbindrec
(macro).
fbindrec*
(macro).
letrec-restriction-violation
(condition).
*lexenv*
(special variable).
analyze-fbinds
(function).
args-of
(reader method).
(setf args-of)
(writer method).
body-decls
(function).
build-bind/ftype
(function).
declared-ftype
(function).
expand-fbindings
(function).
gensym?
(function).
ignored-functions-in-body
(function).
ignored-functions-in-decls
(function).
invalid
(function).
let-over-lambda
(function).
merely-syntactic-functions
(function).
partition-declarations-by-kind
(function).
partition-fbinds
(function).
simple-lambda-list?
(function).
serapeum/level0/static-let.lisp
fbind.lisp
(file).
level0
(module).
flush-all-static-binding-groups
(function).
flush-static-binding-group
(function).
recklessly-continue
(function).
static-binding-active-error
(function).
static-binding-active-error
(condition).
static-binding-flush-error
(function).
static-binding-flush-error
(condition).
static-binding-flush-error-all-groups-p
(reader method).
static-binding-flush-error-group
(reader method).
static-let
(macro).
static-let*
(macro).
%flush
(function).
%make-static-binding
(function).
*active-groups*
(special variable).
*flushable-bindings*
(special variable).
*flushing-lock*
(special variable).
canonicalize-binding
(function).
check-no-dynamic-extent
(function).
initializedp
(reader).
(setf initializedp)
(writer).
lock
(reader).
make-active-groups-binding
(function).
make-flusher
(function).
make-initform
(function).
make-let-binding
(function).
make-macrolet-binding
(function).
make-static-binding
(function).
make-type-declaration
(function).
name
(reader).
(setf name)
(writer).
parse-static-let
(function).
parse-static-let*
(function).
read-only
(reader).
(setf read-only)
(writer).
report-group-substring
(function).
report-static-binding-active-error
(function).
report-static-binding-flush-error
(function).
static-binding
(structure).
value
(reader).
(setf value)
(writer).
value-ref
(function).
(setf value-ref)
(function).
variable-name
(type).
with-canonicalized-binding-accessors
(macro).
serapeum/level0/reader.lisp
definitions.lisp
(file).
level0
(module).
with-standard-input-syntax
(macro).
+storage-for-deflex-var-standard-input-syntax-vars+
(constant).
call/standard-input-syntax
(function).
standard-input-syntax-values
(symbol macro).
standard-input-syntax-vars
(symbol macro).
serapeum/level0/packages.lisp
level0
(module).
export-always
(macro).
export-only
(function).
export-only-always
(macro).
find-external-symbol
(function).
package-exports
(function).
package-name-keyword
(function).
package-names
(function).
serapeum/level0/heap.lisp
types.lisp
(file).
fbind.lisp
(file).
level0
(module).
heap-extract
(function).
heap-extract-all
(function).
heap-extract-maximum
(function).
heap-insert
(function).
heap-maximum
(function).
make-heap
(function).
copy-heap
(function).
heap
(structure).
heap-key
(reader).
(setf heap-key)
(writer).
heap-left
(function).
heap-p
(function).
heap-parent
(function).
heap-right
(function).
heap-test
(reader).
(setf heap-test)
(writer).
heap-vector
(reader).
heapify
(function).
serapeum/level1/lists.lisp
level1
(module).
append1
(function).
assocadr
(function).
assocar
(function).
assocdr
(function).
car-safe
(function).
cdr-safe
(function).
delq
(function).
efface
(function).
filter-map
(compiler macro).
filter-map
(function).
firstn
(function).
in
(compiler macro).
in
(function).
intersectionp
(function).
mapcar-into
(function).
mapply
(compiler macro).
mapply
(function).
memq
(compiler macro).
memq
(function).
nconc1
(function).
nthrest
(function).
plist-keys
(function).
plist-values
(function).
pop-assoc
(macro).
powerset
(function).
prepend
(function).
prependf
(macro).
push-end
(macro).
push-end-new
(macro).
rassocar
(function).
rassocdr
(function).
stable-set-difference
(function).
list+length
(function).
list-map-from-end/bordeaux
(function).
serapeum/level1/sequences.lisp
lists.lisp
(file).
level1
(module).
assort
(function).
batches
(function).
bestn
(function).
bisect-left
(function).
bisect-right
(function).
collapse-duplicates
(function).
copy-firstn
(function).
deltas
(function).
do-each
(macro).
do-splits
(macro).
drop
(function).
drop-prefix
(function).
drop-suffix
(function).
drop-until
(function).
drop-while
(function).
dsu-sort
(function).
dsu-sort-new
(function).
ensure-prefix
(function).
ensure-suffix
(function).
extrema
(function).
filter
(compiler macro).
filter
(function).
filterf
(macro).
frequencies
(function).
gcp
(function).
gcs
(function).
halves
(function).
inconsistent-graph
(condition).
inconsistent-graph-constraints
(reader method).
intersperse
(function).
keep
(compiler macro).
keep
(function).
length<
(function).
length<=
(function).
length>
(function).
length>=
(function).
longer
(function).
longest
(function).
make-load-form
(method).
mvfold
(compiler macro).
mvfold
(function).
mvfoldr
(compiler macro).
mvfoldr
(function).
nsplice-seq
(function).
nsplice-seqf
(macro).
nsubseq
(function).
(setf nsubseq)
(function).
nth-best
(function).
nth-best!
(function).
nub
(compiler macro).
nub
(function).
null-if-empty
(function).
of-length
(compiler macro).
of-length
(function).
only-elt
(function).
ordering
(function).
partition
(function).
partitions
(function).
print-object
(method).
repeat-sequence
(compiler macro).
repeat-sequence
(function).
reshuffle
(function).
runs
(function).
same
(function).
scan
(function).
seq=
(compiler macro).
seq=
(function).
sequencep
(function).
shorter
(function).
shortest
(function).
single
(function).
single
(type).
(setf slice)
(setf expander).
slice
(function).
sort-new
(function).
splice-seq
(function).
splice-seqf
(macro).
stable-sort-new
(function).
take
(function).
take-until
(function).
take-while
(function).
toposort
(function).
%constructor=
(method).
%do-each
(macro).
agroup
(function).
agroup
(structure).
agroup-bucket
(reader).
agroup-exemplar
(reader).
array-size-difference
(type).
bucket-append
(function).
bucket-push
(function).
bucket-seq
(function).
canonicalize-key
(function).
canonicalize-test
(function).
constructor-values/generic
(method).
copy-agroup
(function).
default-tie-breaker
(function).
do-each/map
(macro).
do-subseq
(macro).
do-vector
(macro).
expand-mvfold
(function).
filter/counted
(function).
filter/swapped-arguments
(function).
function-name
(type).
intersperse/list
(function).
intersperse/seq
(function).
key-designator
(type).
key-test
(function).
length-gt
(macro).
list-collapse-duplicates
(function).
list-runs
(function).
longest-list
(function).
longest-seq
(function).
make-bucket
(function).
make-sequence-like
(function).
map-splits
(function).
map-splits-from-end
(function).
map-splits-from-start
(function).
map-subseq
(function).
mvfold-aux
(function).
nsplice-list
(function).
nsplice-vector
(function).
quickselect
(function).
read-only-struct-slot-names
(method).
repeat-list
(function).
repeat-vector
(function).
rotation
(function).
seq=/2
(function).
setslice
(function).
shortest-list
(function).
shortest-seq
(function).
shortest/longest
(function).
signed-array-index
(type).
signed-array-length
(type).
slice-bounds
(function).
splice-list
(function).
splice-vector
(function).
split-at
(function).
test-designator
(type).
tsort
(function).
tsort/hash-table
(function).
tsort/list
(function).
with-list-bucket
(macro).
with-sequence-bucket
(macro).
with-specialized-buckets
(macro).
with-string-bucket
(macro).
with-vector-bucket
(macro).
serapeum/level1/strings.lisp
sequences.lisp
(file).
level1
(module).
ascii-char-p
(function).
blankp
(function).
chomp
(function).
collapse-whitespace
(function).
concat
(function).
ellipsize
(function).
escape
(compiler macro).
escape
(function).
fmt
(compiler macro).
fmt
(function).
lines
(function).
mapconcat
(function).
nstring-invert-case
(function).
nstring-upcase-initials
(function).
same-case-p
(function).
string$=
(compiler macro).
string$=
(function).
string*=
(compiler macro).
string*=
(function).
string+
(compiler macro).
string+
(function).
string-contains-p
(compiler macro).
string-contains-p
(function).
string-count
(function).
string-invert-case
(function).
string-join
(function).
string-prefix-p
(compiler macro).
string-prefix-p
(function).
string-replace
(function).
string-replace-all
(function).
string-suffix-p
(compiler macro).
string-suffix-p
(function).
string-token-p
(function).
string-upcase-initials
(function).
string^=
(compiler macro).
string^=
(function).
string~=
(function).
tokens
(function).
trim-whitespace
(function).
whitespace
(symbol macro).
whitespacep
(function).
with-string
(macro).
word-wrap
(function).
words
(function).
+storage-for-deflex-var-no-break-space+
(constant).
+storage-for-deflex-var-whitespace+
(constant).
call/string
(function).
copy-string
(function).
digit-length
(function).
escape/no-arg-parsing
(function).
fixed-print-length-type
(type).
mapconcat/list
(function).
mapconcat/seq
(function).
no-break-space
(symbol macro).
simplify-args-for-string-plus
(function).
simplify-string
(function).
string-offset
(type).
serapeum/level1/vectors.lisp
lists.lisp
(file).
level1
(module).
ensure-vector
(function).
pad-end
(compiler macro).
pad-end
(function).
pad-start
(compiler macro).
pad-start
(function).
values-vector
(function).
vect
(compiler macro).
vect
(function).
vector-conc-extend
(function).
expand-pad-x
(function).
generate-values-vector-case
(macro).
serapeum/level2/exporting.lisp
level2
(module).
def
(macro).
defalias
(macro).
defclass
(macro).
defconst
(macro).
defconstant
(macro).
defgeneric
(macro).
define-symbol-macro
(macro).
define-values
(macro).
defmacro
(macro).
defmethod
(macro).
defparameter
(macro).
deftype
(macro).
defun
(macro).
defvar
(macro).
define-simple-exporter
(macro).
serapeum/level2/vector=.lisp
level2
(module).
make-load-form
(method).
print-object
(method).
vector=
(function).
%constructor=
(method).
+storage-for-deflex-var-octet-vector-class+
(constant).
bounds
(function).
bounds
(structure).
bounds-end1
(reader).
bounds-end2
(reader).
bounds-plausible?
(generic function).
bounds-start1
(reader).
bounds-start2
(reader).
bounds-trivial?
(function).
compare-elements
(generic function).
constructor-values/generic
(method).
copy-bounds
(function).
float-vector
(class).
numeric-vector
(class).
octet-vector-class
(symbol macro).
rat-vector
(class).
read-only-struct-slot-names
(method).
reify-bounds
(function).
test-fn
(function).
test-kind
(function).
test.fn
(generic function).
test/=
(symbol macro).
test/=
(class).
test/char-equal
(symbol macro).
test/char-equal
(class).
test/char=
(symbol macro).
test/char=
(class).
test/eq
(symbol macro).
test/eq
(class).
test/eql
(symbol macro).
test/eql
(class).
test/equal
(symbol macro).
test/equal
(class).
test/equalp
(symbol macro).
test/equalp
(class).
test/rat=
(class).
unwrap
(reader method).
vector-kind
(function).
vector-wrapper
(class).
with-bounds
(macro).
serapeum/level2/mop.lisp
level2
(module).
initialize-instance
(method).
print-object
(method).
reinitialize-instance
(method).
standard/context
(method combination).
topmost-object-class
(class).
validate-superclass
(method).
insert-superclass
(function).
topmost-class
(reader method).
serapeum/level2/internal-definitions.lisp
level2
(module).
block-compile
(macro).
local
(macro).
local*
(macro).
make-load-form
(method).
print-object
(method).
%binding
(class).
%constructor=
(method).
*internal-definitions-slots*
(special variable).
*subenv*
(special variable).
alias-decls
(method).
at-beginning?
(method).
augment/block
(function).
augment/funs
(function).
augment/macros
(function).
augment/symbol-macros
(function).
augment/tags
(function).
augment/vars
(function).
binding
(type).
binding-init
(reader method).
binding-name
(reader method).
body
(type).
check-beginning
(method).
constructor-values/generic
(method).
copy-subenv
(function).
define-env-method
(macro).
eject-macro
(method).
ensure-var-alias
(method).
expand-binding
(function).
expand-bindings
(function).
expand-body
(method).
expand-in-env
(method).
expand-in-env-1
(method).
expand-partially
(method).
expand-top
(method).
expansion-done
(method).
expr
(type).
extract-tagbody-tags
(function).
fun
(function).
fun
(class).
generate-internal-definitions
(method).
hoisted-var?
(method).
in-subenv?
(method).
initialize-binds-from-decls
(function).
internal-definition-form
(type).
internal-definitions-env
(class).
known-var?
(method).
let-initialized
(macro).
macro
(function).
macro
(class).
read-only-struct-slot-names
(method).
remove-shadowed
(function).
save-symbol-macro
(method).
shadow-names
(function).
shadow-symbol-macro
(method).
splice-forms
(method).
step-expansion
(method).
subenv
(function).
subenv
(structure).
subenv-blocks
(reader).
subenv-empty?
(function).
subenv-funs
(reader).
subenv-tags
(reader).
subenv-vars
(reader).
symbol-macro
(function).
symbol-macro
(class).
symbol-macro-bindings
(function).
tagbody-tag?
(function).
var
(function).
var
(class).
var-alias-bindings
(method).
visible-of-type
(function).
without-internal-definitions
(macro).
wrap-bindings
(method).
wrap-expr
(method).
wrap-fn-bindings
(method).
serapeum/level2/tree-case.lisp
level2
(module).
char-case
(macro).
char-ecase
(macro).
tree-case
(macro).
tree-ecase
(macro).
char-case-1
(macro).
char-ecase-1
(macro).
expand-char-case-keys
(function).
serapeum/level2/dispatch-case.lisp
level2
(module).
dispatch-case
(macro).
dispatch-case-error
(macro).
dispatch-case-error
(condition).
dispatch-case-let
(macro).
dispatch-caseql
(macro).
dispatch-caseql-let
(macro).
branch-type
(function).
clause-leading-type
(function).
collect-fallthrough-clauses
(function).
dispatch-case-error-matched-types
(reader method).
dispatch-case/nobindings
(macro).
ensure-var
(function).
etypecase-of/no-shadows
(macro).
expand-dispatch-caseql-clauses
(function).
hoist-clause-bodies
(function).
matched-types
(symbol macro).
remove-shadowed-clauses
(function).
sort-clauses
(function).
with-matched-type
(macro).
serapeum/level2/range.lisp
dispatch-case.lisp
(file).
level2
(module).
+storage-for-deflex-var-no-bounds-checks+
(constant).
check-range
(function).
check-range/inline
(macro).
count-range
(compiler macro).
count-range
(function).
count-range/1
(function).
count-range/2
(function).
count-range/3
(function).
define-real-range
(macro).
double-float-range
(function).
fill-int-range!
(function).
frange
(function).
int-range-shape
(function).
integer-range
(function).
long-float-range
(function).
no-bounds-checks
(symbol macro).
prepare-int-range
(function).
range-error
(function).
real*
(type).
real-range
(function).
short-float-range
(function).
single-float-range
(function).
with-int-vector
(macro).
serapeum/level2/generalized-arrays.lisp
range.lisp
(file).
level2
(module).
%flatten
(function).
+storage-for-deflex-var-seq-cutoff+
(constant).
displace
(function).
ensure-shape
(function).
link
(function).
mutual-element-type
(function).
pairwise
(function).
reduce-between
(function).
reduce-vector-pairwise
(function).
replace*
(function).
seq-cutoff
(symbol macro).
shape=
(function).
shrink-wrap
(function).
void
(function).
serapeum/level2/units.lisp
level2
(module).
format-human-size
(function).
human-size-formatter
(function).
si-prefix
(function).
+storage-for-deflex-var-iec-prefixes+
(constant).
+storage-for-deflex-var-si-prefixes+
(constant).
+storage-for-deflex-var-si-prefixes-base-1000+
(constant).
iec-prefixes
(symbol macro).
si-prefix-rec
(macro).
si-prefixes
(symbol macro).
si-prefixes-base-1000
(symbol macro).
serapeum/contrib/hooks.lisp
contrib
(module).
add-hook
(method).
add-hook
(method).
add-hook
(method).
add-hook
(method).
combination
(reader method).
(setf combination)
(writer method).
combine-composed-hook
(method).
combine-hook-until-failure
(method).
combine-hook-until-success
(method).
default-combine-hook
(method).
define-hook
(function).
define-hook-type
(macro).
description
(reader method).
(setf description)
(writer method).
disable-hook
(method).
disabled-handlers
(reader method).
(setf disabled-handlers)
(writer method).
enable-hook
(method).
find-handler
(function).
find-hook
(function).
fn
(reader method).
(setf fn)
(writer method).
handler
(class).
handler-any
(class).
handler-number->number
(class).
handler-string->string
(class).
handler-type
(reader method).
(setf handler-type)
(writer method).
handler-void
(class).
handlers
(reader method).
(setf handlers)
(writer method).
hook
(class).
hook-any
(class).
hook-number->number
(class).
hook-string->string
(class).
hook-void
(class).
make-handler-any
(function).
make-handler-number->number
(function).
make-handler-string->string
(function).
make-handler-void
(function).
make-hook-any
(function).
make-hook-number->number
(function).
make-hook-string->string
(function).
make-hook-void
(function).
name
(reader method).
(setf name)
(writer method).
place
(reader method).
(setf place)
(writer method).
remove-hook
(method).
run-hook
(method).
run-hook-with-args-until-failure
(method).
run-hook-with-args-until-success
(method).
value
(reader method).
(setf value)
(writer method).
%hook-table
(special variable).
add-hook-internal
(function).
delete*
(function).
equals
(method).
handler-class
(reader method).
make-handler
(function).
move-hook-handlers
(function).
Packages are listed by definition order.
serapeum/static-let
serapeum.exporting
serapeum/bundle
serapeum/vector=
serapeum
serapeum.sum
serapeum/op
serapeum/dispatch-case
serapeum/generalized-arrays
serapeum-user
serapeum.unlocked
serapeum/contrib/hooks
serapeum/internal-definitions
serapeum/mop
serapeum/static-let
common-lisp
.
%flush
(function).
%make-static-binding
(function).
*active-groups*
(special variable).
*flushable-bindings*
(special variable).
*flushing-lock*
(special variable).
all-groups-p
(slot).
canonicalize-binding
(function).
check-no-dynamic-extent
(function).
group
(slot).
initializedp
(reader).
(setf initializedp)
(writer).
lock
(reader).
make-active-groups-binding
(function).
make-flusher
(function).
make-initform
(function).
make-let-binding
(function).
make-macrolet-binding
(function).
make-static-binding
(function).
make-type-declaration
(function).
name
(reader).
(setf name)
(writer).
parse-static-let
(function).
parse-static-let*
(function).
read-only
(reader).
(setf read-only)
(writer).
report-group-substring
(function).
report-static-binding-active-error
(function).
report-static-binding-flush-error
(function).
static-binding
(structure).
value
(reader).
(setf value)
(writer).
value-ref
(function).
(setf value-ref)
(function).
variable-name
(type).
with-canonicalized-binding-accessors
(macro).
serapeum.exporting
def
(macro).
defalias
(macro).
defclass
(macro).
defconst
(macro).
defconstant
(macro).
defgeneric
(macro).
define-symbol-macro
(macro).
define-values
(macro).
defmacro
(macro).
defmethod
(macro).
defparameter
(macro).
deftype
(macro).
defun
(macro).
defvar
(macro).
serapeum/vector=
alexandria
.
common-lisp
.
serapeum
.
+storage-for-deflex-var-octet-vector-class+
(constant).
bounds
(function).
bounds
(structure).
bounds-end1
(reader).
bounds-end2
(reader).
bounds-plausible?
(generic function).
bounds-start1
(reader).
bounds-start2
(reader).
bounds-trivial?
(function).
compare-elements
(generic function).
copy-bounds
(function).
float-vector
(class).
numeric-vector
(class).
octet-vector-class
(symbol macro).
rat-vector
(class).
reify-bounds
(function).
test-fn
(function).
test-kind
(function).
test.fn
(generic function).
test/=
(symbol macro).
test/=
(class).
test/char-equal
(symbol macro).
test/char-equal
(class).
test/char=
(symbol macro).
test/char=
(class).
test/eq
(symbol macro).
test/eq
(class).
test/eql
(symbol macro).
test/eql
(class).
test/equal
(symbol macro).
test/equal
(class).
test/equalp
(symbol macro).
test/equalp
(class).
test/rat=
(class).
unwrap
(generic reader).
vector-kind
(function).
vector-wrapper
(class).
with-bounds
(macro).
serapeum
Utilities beyond Alexandria.
common-lisp
.
*boolean-bypass*
(special variable).
*hook*
(special variable).
+merge-tail-calls+
(constant).
->
(macro).
->
(type).
@
(compiler macro).
(setf @)
(compiler macro).
@
(function).
(setf @)
(function).
absolute-directory-pathname
(type).
absolute-pathname
(type).
add-hook
(generic function).
and-let*
(macro).
append1
(function).
array-index-row-major
(function).
ascii-char-p
(function).
assocadr
(function).
assocar
(function).
assocdr
(function).
assort
(function).
assure
(macro).
assure
(type).
assuref
(macro).
base-path-join
(function).
batches
(function).
bcond
(macro).
bestn
(function).
bisect-left
(function).
bisect-right
(function).
bits
(function).
blankp
(function).
block-compile
(macro).
boolean-if
(macro).
boolean-unless
(macro).
boolean-when
(macro).
bound-value
(function).
(setf bound-value)
(function).
box
(function).
box
(structure).
callf
(macro).
callf2
(macro).
capped-fork
(compiler macro).
capped-fork
(function).
capped-fork2
(compiler macro).
capped-fork2
(function).
car+cdr
(function).
car-safe
(function).
case-failure
(function).
case-failure
(condition).
case-let
(macro).
case-of
(macro).
case-using
(macro).
ccase-let
(macro).
ccase-of
(macro).
cdr-safe
(function).
char-case
(macro).
char-ecase
(macro).
chomp
(function).
class-name-of
(function).
class-name-safe
(function).
clear-queue
(function).
collapse-duplicates
(function).
collapse-whitespace
(function).
collecting
(macro).
comment
(macro).
concat
(function).
cond-every
(macro).
cond-let
(macro).
copy-firstn
(function).
copy-queue
(function).
count-cpus
(function).
ctypecase-let
(macro).
ctypecase-of
(macro).
date-leap-year-p
(function).
deconstruct
(function).
def
(macro).
defalias
(macro).
defcondition
(macro).
defconst
(macro).
defconstructor
(macro).
define-case-macro
(macro).
define-do-macro
(macro).
define-post-modify-macro
(macro).
define-train
(macro).
define-values
(macro).
defloop
(macro).
defmethods
(macro).
defparameter-unbound
(macro).
defplace
(macro).
defstruct-read-only
(macro).
defsubst
(macro).
defunion
(macro).
defunit
(macro).
defvar-unbound
(macro).
delete-from-hash-table
(function).
delq
(function).
deltas
(function).
deq
(function).
destructuring-case-of
(macro).
destructuring-ccase-of
(macro).
destructuring-ecase-of
(macro).
dict
(compiler macro).
dict
(function).
dict*
(function).
dictq
(macro).
directory-pathname
(type).
dispatch-case
(macro).
dispatch-case-error
(macro).
dispatch-case-error
(condition).
dispatch-case-let
(macro).
dispatch-caseql
(macro).
dispatch-caseql-let
(macro).
distinct
(function).
do-each
(macro).
do-hash-table
(macro).
do-nothing
(compiler macro).
do-nothing
(function).
do-splits
(macro).
drop
(function).
drop-prefix
(function).
drop-suffix
(function).
drop-until
(function).
drop-while
(function).
dsu-sort
(function).
dsu-sort-new
(function).
dynamic-closure
(function).
ecase-let
(macro).
ecase-of
(macro).
ecase-using
(macro).
econd
(macro).
econd-failure
(condition).
econd-let
(macro).
efface
(function).
eif
(macro).
eif-let
(macro).
ellipsize
(function).
enq
(function).
ensure
(macro).
(setf ensure)
(setf expander).
ensure-prefix
(function).
ensure-suffix
(function).
ensure-vector
(function).
ensure2
(macro).
(setf ensure2)
(setf expander).
eq*
(compiler macro).
eq*
(function).
eql*
(compiler macro).
eql*
(function).
eqls
(compiler macro).
eqls
(function).
eqs
(compiler macro).
eqs
(function).
equal*
(compiler macro).
equal*
(function).
equalp*
(compiler macro).
equalp*
(function).
equals
(compiler macro).
equals
(function).
escape
(compiler macro).
escape
(function).
etypecase-let
(macro).
etypecase-of
(macro).
eval-always
(macro).
eval-and-compile
(macro).
eval-if-constant
(function).
example
(macro).
exe
(function).
expand-macro
(function).
expand-macro-recursively
(function).
expect-form-list
(function).
expect-single-form
(function).
export-always
(macro).
export-only
(function).
export-only-always
(macro).
extrema
(function).
fbind
(macro).
fbind*
(macro).
fbindrec
(macro).
fbindrec*
(macro).
fdec
(macro).
file-pathname
(type).
file-size
(function).
file-size-human-readable
(function).
file=
(function).
filter
(compiler macro).
filter
(function).
filter-map
(compiler macro).
filter-map
(function).
filterf
(macro).
finc
(macro).
find-class-safe
(function).
find-external-symbol
(function).
find-keyword
(function).
firstn
(function).
fixnump
(function).
flip
(compiler macro).
flip
(function).
flip-hash-table
(function).
float-precision-contagion
(function).
flush-all-static-binding-groups
(function).
flush-static-binding-group
(function).
fmt
(compiler macro).
fmt
(function).
fnil
(compiler macro).
fnil
(function).
fork
(compiler macro).
fork
(function).
fork2
(compiler macro).
fork2
(function).
format-file-size-human-readable
(function).
format-human-size
(function).
frequencies
(function).
front
(function).
(setf front)
(function).
fuel
(function).
gcp
(function).
gcs
(function).
get-unix-time
(function).
grow
(function).
growf
(macro).
halves
(function).
hash-fold
(function).
hash-table-function
(function).
hash-table-predicate
(function).
hash-table-set
(function).
hash-table-test-p
(function).
heap-extract
(function).
heap-extract-all
(function).
heap-extract-maximum
(function).
heap-insert
(function).
heap-maximum
(function).
hook
(compiler macro).
hook
(function).
hook2
(compiler macro).
hook2
(function).
href
(compiler macro).
(setf href)
(compiler macro).
href
(function).
(setf href)
(function).
href-default
(function).
human-size-formatter
(function).
if-not
(macro).
if-not-let
(macro).
ignoring
(macro).
in
(compiler macro).
in
(function).
inconsistent-graph
(condition).
inconsistent-graph-constraints
(generic reader).
input-stream
(type).
intersectionp
(function).
intersperse
(function).
interval
(compiler macro).
interval
(function).
juxt
(compiler macro).
juxt
(function).
keep
(compiler macro).
keep
(function).
leaf-map
(function).
leaf-walk
(function).
length<
(function).
length<=
(function).
length>
(function).
length>=
(function).
letrec
(macro).
letrec*
(macro).
letrec-restriction-violation
(condition).
lines
(function).
local
(macro).
local*
(macro).
longer
(function).
longest
(function).
lret
(macro).
lret*
(macro).
make
(compiler macro).
make
(function).
make-hash-table-function
(function).
make-heap
(function).
make-octet-vector
(function).
map-tree
(function).
mapcar-into
(function).
mapconcat
(function).
maphash-into
(function).
maphash-new
(function).
maphash-return
(function).
mapply
(compiler macro).
mapply
(function).
match-of
(macro).
maybe-invoke-restart
(function).
memq
(compiler macro).
memq
(function).
merge-tables
(function).
monitor
(generic function).
mvconstantly
(compiler macro).
mvconstantly
(function).
mvfold
(compiler macro).
mvfold
(function).
mvfoldr
(compiler macro).
mvfoldr
(function).
mvlet
(macro).
mvlet*
(macro).
nand
(macro).
nconc1
(function).
nest
(macro).
nix
(macro).
nlet
(macro).
no
(compiler macro).
no
(function).
no-applicable-method-error
(type).
non-wild-pathname
(type).
nor
(macro).
nor
(type).
nsplice-seq
(function).
nsplice-seqf
(macro).
nstring-invert-case
(function).
nstring-upcase-initials
(function).
nsubseq
(function).
(setf nsubseq)
(function).
nth-arg
(compiler macro).
nth-arg
(function).
nth-best
(function).
nth-best!
(function).
nthrest
(function).
nub
(compiler macro).
nub
(function).
null-if
(function).
null-if-empty
(function).
null-if-zero
(function).
occurs
(function).
occurs-if
(function).
octet
(type).
octet-vector
(compiler macro).
octet-vector
(function).
octet-vector
(type).
octet-vector-p
(function).
octet-vector=
(function).
octets
(function).
of-length
(compiler macro).
of-length
(function).
once
(compiler macro).
once
(function).
only-elt
(function).
op
(macro).
opf
(macro).
ordering
(function).
output-stream
(type).
package-exports
(function).
package-name-keyword
(function).
package-names
(function).
pad-end
(compiler macro).
pad-end
(function).
pad-start
(compiler macro).
pad-start
(function).
pairhash
(function).
parse-float
(compiler macro).
parse-float
(function).
parse-leading-keywords
(function).
partial
(compiler macro).
partial
(function).
partition
(function).
partition-declarations
(function).
partitions
(function).
path-basename
(function).
path-join
(function).
plist-keys
(function).
plist-values
(function).
pop-assoc
(macro).
pophash
(function).
powerset
(function).
prepend
(function).
prependf
(macro).
pretty-print-hash-table
(function).
prod
(function).
proper-subtype-p
(function).
proper-supertype-p
(function).
prune
(function).
prune-if
(function).
push-end
(macro).
push-end-new
(macro).
qappend
(function).
qback
(function).
(setf qback)
(function).
qconc
(function).
qlen
(function).
qlist
(function).
qpreconc
(function).
qprepend
(function).
queue
(compiler macro).
queue
(function).
queue
(structure).
queue-empty-p
(function).
queuep
(function).
random-in-range
(compiler macro).
random-in-range
(function).
range
(compiler macro).
range
(function).
rassocar
(function).
rassocdr
(function).
ravel
(function).
read-eval-prefix
(function).
receive
(macro).
recklessly-continue
(function).
recursion-forbidden
(condition).
relative-pathname
(type).
remove-hook
(generic function).
repeat-sequence
(compiler macro).
repeat-sequence
(function).
repeat-until-stable
(function).
reshape
(function).
reshuffle
(function).
resolve-executable
(function).
reuse-cons
(function).
round-to
(function).
run-hook
(generic function).
run-hook-until-failure
(generic function).
run-hook-until-success
(generic function).
run-hooks
(function).
runs
(function).
same
(function).
same-case-p
(function).
scan
(function).
select
(macro).
selector
(macro).
seq=
(compiler macro).
seq=
(function).
sequencep
(function).
set-hash-table
(function).
shape
(function).
shorter
(function).
shortest
(function).
shrink
(function).
shrinkf
(macro).
si-prefix
(function).
single
(function).
single
(type).
(setf slice)
(setf expander).
slice
(function).
(setf slot-value-safe)
(setf expander).
slot-value-safe
(function).
soft-alist-of
(type).
soft-list-of
(type).
sort-new
(function).
sort-values
(macro).
splice-seq
(function).
splice-seqf
(macro).
stable-set-difference
(function).
stable-sort-new
(function).
standard/context
(method combination).
static-binding-active-error
(function).
static-binding-active-error
(condition).
static-binding-flush-error
(function).
static-binding-flush-error
(condition).
static-binding-flush-error-all-groups-p
(generic reader).
static-binding-flush-error-group
(generic reader).
static-let
(macro).
static-let*
(macro).
static-load-time-value
(macro).
static-load-time-value-error
(condition).
string$=
(compiler macro).
string$=
(function).
string*=
(compiler macro).
string*=
(function).
string+
(compiler macro).
string+
(function).
string-case
(macro).
string-contains-p
(compiler macro).
string-contains-p
(function).
string-count
(function).
string-ecase
(macro).
string-gensym
(function).
string-invert-case
(function).
string-join
(function).
string-prefix-p
(compiler macro).
string-prefix-p
(function).
string-replace
(function).
string-replace-all
(function).
string-suffix-p
(compiler macro).
string-suffix-p
(function).
string-token-p
(function).
string-upcase-initials
(function).
string^=
(compiler macro).
string^=
(function).
string~=
(function).
subclass-union
(type).
summing
(macro).
supertypep
(function).
swaphash
(function).
synchronized
(macro).
synchronized
(class).
take
(function).
take-until
(function).
take-while
(function).
throttle
(function).
time-since
(function).
time-until
(function).
toggle-pretty-print-hash-table
(function).
tokens
(function).
topmost-object-class
(class).
toposort
(function).
trampoline
(function).
tree-case
(macro).
tree-ecase
(macro).
trim-whitespace
(function).
true
(compiler macro).
true
(function).
true
(type).
tuple
(type).
typecase-let
(macro).
typecase-of
(macro).
unary->variadic
(compiler macro).
unary->variadic
(function).
unbits
(function).
unbox
(reader).
(setf unbox)
(writer).
undeq
(function).
undisplace-array
(function).
unique-name
(function).
universal-to-unix
(function).
unix-to-universal
(function).
unoctets
(function).
unparse-ordinary-lambda-list
(function).
unsplice
(function).
values-vector
(function).
variadic->unary
(compiler macro).
variadic->unary
(function).
vect
(compiler macro).
vect
(function).
vector-conc-extend
(function).
vector=
(function).
vref
(macro).
walk-tree
(function).
whitespace
(symbol macro).
whitespacep
(function).
wholenum
(type).
wild-pathname
(type).
with-boolean
(macro).
with-collector
(macro).
with-collectors
(macro).
with-hook-restart
(macro).
with-item-key-function
(macro).
with-member-test
(macro).
with-open-files
(macro).
with-read-only-vars
(macro).
with-simple-vector-dispatch
(macro).
with-standard-input-syntax
(macro).
with-string
(macro).
with-string-dispatch
(macro).
with-subtype-dispatch
(macro).
with-thunk
(macro).
with-two-arg-test
(macro).
with-type-dispatch
(macro).
with-vector-dispatch
(macro).
without-recursion
(macro).
word-wrap
(function).
words
(function).
write-file-into-stream
(function).
write-stream-into-file
(function).
~>
(macro).
~>>
(macro).
$path
(function).
%all-branches%
(symbol macro).
%constructor=
(generic function).
%do-each
(macro).
%in-branching%
(symbol macro).
%read-only-struct
(structure).
(setf %read-only-var)
(function).
%require-type
(function).
%require-type-for
(function).
%unit
(structure).
%with-boolean
(macro).
*case-macro-target*
(special variable).
*forbidden-heads*
(special variable).
*lexenv*
(special variable).
*monitors*
(special variable).
*recursions*
(special variable).
*soft-list-cutoff*
(special variable).
*units*
(special variable).
*vref-by-type*
(special variable).
+alist-breakeven+
(symbol macro).
+atomic-accessors+
(constant).
+hash-table-default-size+
(constant).
+pathsep+
(constant).
+seconds-in-day+
(constant).
+seconds-in-hour+
(constant).
+storage-for-deflex-var-+alist-breakeven++
(constant).
+storage-for-deflex-var-iec-prefixes+
(constant).
+storage-for-deflex-var-no-bounds-checks+
(constant).
+storage-for-deflex-var-no-break-space+
(constant).
+storage-for-deflex-var-si-prefixes+
(constant).
+storage-for-deflex-var-si-prefixes-base-1000+
(constant).
+storage-for-deflex-var-standard-input-syntax-vars+
(constant).
+storage-for-deflex-var-whitespace+
(constant).
+unix-epoch+
(constant).
agroup
(function).
agroup
(structure).
agroup-bucket
(reader).
agroup-exemplar
(reader).
analyze-fbinds
(function).
args-of
(generic reader).
(setf args-of)
(generic writer).
array-size-difference
(type).
assure-values
(macro).
body-decls
(function).
boxp
(function).
bucket-append
(function).
bucket-push
(function).
bucket-seq
(function).
build-bind/ftype
(function).
call-with-array-data/copy
(function).
call-with-array-data/fast
(function).
call/standard-input-syntax
(function).
call/string
(function).
canonicalize-bindings
(function).
canonicalize-key
(function).
canonicalize-test
(function).
case-using-aux
(macro).
char-case-1
(macro).
char-ecase-1
(macro).
check-exhaustiveness
(function).
check-match-exhaustive
(function).
check-no-underscores
(function).
check-range
(function).
check-range/inline
(macro).
check-same-test
(function).
clauses+default
(function).
collecting*
(macro).
conditional-error
(function).
constructor-values/generic
(generic function).
constructor=
(function).
copy-agroup
(function).
copy-box
(function).
copy-hash-table/empty
(function).
copy-heap
(function).
copy-string
(function).
count-cpus-string
(function).
count-range
(compiler macro).
count-range
(function).
count-range/1
(function).
count-range/2
(function).
count-range/3
(function).
declaim-constant-function
(macro).
declaim-freeze-type
(macro).
declaim-freeze-type-1
(macro).
declaim-maybe-inline
(macro).
declaim-maybe-inline-1
(macro).
declared-ftype
(function).
default-tie-breaker
(function).
define-real-range
(macro).
define-simple-exporter
(macro).
define-variadic-equality
(macro).
describe-non-exhaustive-match
(function).
digit-length
(function).
do-each/map
(macro).
do-subseq
(macro).
do-vector
(macro).
double-float-range
(function).
ensure-monitor
(function).
ensuring-functions
(macro).
env-super
(function).
escape/no-arg-parsing
(function).
expand-case-macro
(function).
expand-case-macro/common
(function).
expand-case-macro/flet
(function).
expand-case-macro/tagbody
(function).
expand-char-case-keys
(function).
expand-destructuring-case-of
(function).
expand-fbindings
(function).
expand-href
(function).
expand-mvfold
(function).
expand-nest
(function).
expand-pad-x
(function).
expand-read-only-var
(function).
expand-variadic-equality
(function).
explode-type
(function).
exponent-char-format
(function).
exponent-char?
(function).
extract-function-name
(function).
false
(type).
file=/loop
(function).
fill-int-range!
(function).
filter/counted
(function).
filter/swapped-arguments
(function).
firstn-values
(macro).
fixed-print-length-type
(type).
flet*
(macro).
frange
(function).
function-name
(type).
generate-values-vector-case
(macro).
gensym?
(function).
heap
(structure).
heap-key
(reader).
(setf heap-key)
(writer).
heap-left
(function).
heap-p
(function).
heap-parent
(function).
heap-right
(function).
heap-test
(reader).
(setf heap-test)
(writer).
heap-vector
(reader).
heapify
(function).
iec-prefixes
(symbol macro).
if-let1
(macro).
ignored-functions-in-body
(function).
ignored-functions-in-decls
(function).
include+opts
(function).
int-range-shape
(function).
integer-range
(function).
intern-unit
(function).
intersperse/list
(function).
intersperse/seq
(function).
invalid
(function).
key-designator
(type).
key-test
(function).
lambda-list-vars
(function).
length-gt
(macro).
let-over-lambda
(function).
let1
(macro).
letrec-with
(macro).
list+length
(function).
list-collapse-duplicates
(function).
list-map-from-end/bordeaux
(function).
list-runs
(function).
lock-form
(function).
long-float-range
(function).
longest-list
(function).
longest-seq
(function).
lret-aux
(macro).
make-bucket
(function).
make-float
(function).
make-queue
(function).
make-queue-cons
(function).
make-sequence-like
(function).
make-unique-name-list
(function).
map-splits
(function).
map-splits-from-end
(function).
map-splits-from-start
(function).
map-subseq
(function).
map-tree/inorder
(function).
map-tree/postorder
(function).
map-tree/preorder
(function).
mapconcat/list
(function).
mapconcat/seq
(function).
merely-syntactic-functions
(function).
merge-tables!
(function).
missing-branch
(function).
mvdef
(macro).
mvfold-aux
(function).
nix-1
(macro).
no-bounds-checks
(symbol macro).
no-break-space
(symbol macro).
normalize-cases
(function).
nsplice-list
(function).
nsplice-vector
(function).
object
(type).
octet-vector=/unsafe
(function).
parse-defmethod-args
(function).
partition-declarations-by-kind
(function).
partition-fbinds
(function).
pattern-type
(function).
physical-pathname
(type).
policy-quality
(function).
policy-quality-in-env
(macro).
policy>
(function).
prepare-int-range
(function).
print-constructor
(function).
print-unit
(function).
proper-alist?
(function).
proper-list-without-nil?
(function).
proper-list?
(function).
queue-cons
(reader).
quickselect
(function).
quote-unless-constant
(function).
random-range-type
(function).
range-error
(function).
read-float
(function).
read-float-aux
(function).
read-new-value
(function).
read-only-include-clause
(function).
read-only-slotdef
(function).
read-only-struct-slot-names
(generic function).
read-only-var
(macro).
(setf read-only-var)
(setf expander).
real*
(type).
real-range
(function).
rebinding-functions
(macro).
remove-duplicated-subtypes
(function).
remove-shadowed-subtypes
(function).
repeat-list
(function).
repeat-vector
(function).
require-type
(compiler macro).
require-type
(function).
require-type-for
(compiler macro).
require-type-for
(function).
rotation
(function).
same-literal-p
(function).
same-test?
(function).
same-type?
(function).
seq-dispatch
(macro).
seq=/2
(function).
setslice
(function).
short-float-range
(function).
shortest-list
(function).
shortest-seq
(function).
shortest/longest
(function).
si-prefix-rec
(macro).
si-prefixes
(symbol macro).
si-prefixes-base-1000
(symbol macro).
signed-array-index
(type).
signed-array-length
(type).
simple-binding-p
(function).
simple-lambda-list?
(function).
simplify-args-for-string-plus
(function).
simplify-keylists
(function).
simplify-string
(function).
simplify-subtypes
(function).
single-float-range
(function).
slice-bounds
(function).
sort-subtypes
(function).
sort-values/network
(macro).
sort-values/temp-vector
(macro).
sorting-network
(function).
sorting-networks
(symbol macro).
speed-matters?
(function).
splice-list
(function).
splice-vector
(function).
split-at
(function).
stack-flet
(macro).
standard-input-syntax-values
(symbol macro).
standard-input-syntax-vars
(symbol macro).
string-case-failure
(function).
string-offset
(type).
struct-to-try-instantiating
(structure).
subtypes-exhaustive?
(function).
test-designator
(type).
test-load-time-value
(compiler macro).
test-load-time-value
(function).
thread-aux
(function).
truly-the
(macro).
tsort
(function).
tsort/hash-table
(function).
tsort/list
(function).
type-vref
(function).
unbound
(function).
unbound
(structure).
unbound-p
(function).
unbound-var
(reader).
variable-special?
(function).
variable-type
(function).
variable-type-in-env
(macro).
vector-dispatch
(macro).
with-current-package-symbols
(macro).
with-int-vector
(macro).
with-list-bucket
(macro).
with-nullable
(macro).
with-sequence-bucket
(macro).
with-simple-vector
(macro).
with-specialized-buckets
(macro).
with-string-bucket
(macro).
with-type-declarations-trusted
(macro).
with-vector-bucket
(macro).
with-vref
(macro).
wrong-type
(macro).
serapeum/op
alexandria
.
common-lisp
.
serapeum
.
body+vars
(function).
extract-op-env
(function).
free?
(function).
make-op-env
(function).
numbered-placeholder?
(function).
op-env
(class).
op-env-lambda
(generic function).
op/no-walker
(macro).
placeholder?
(function).
quotation?
(function).
rest-arg
(symbol macro).
rest-op?
(function).
rest-placeholder?
(function).
sym-numbered-placeholder?
(function).
sym-rest-arg?
(function).
sym-underscore?
(function).
underscore
(symbol macro).
var-lexical?
(function).
serapeum/dispatch-case
alexandria
.
common-lisp
.
serapeum
.
branch-type
(function).
clause-leading-type
(function).
collect-fallthrough-clauses
(function).
dispatch-case-error-matched-types
(generic reader).
dispatch-case/nobindings
(macro).
ensure-var
(function).
etypecase-of/no-shadows
(macro).
expand-dispatch-caseql-clauses
(function).
hoist-clause-bodies
(function).
matched-types
(symbol macro).
matched-types-slot
(slot).
remove-shadowed-clauses
(function).
sort-clauses
(function).
with-matched-type
(macro).
serapeum/generalized-arrays
Implementation of generalized arrays.
alexandria
.
common-lisp
.
serapeum
.
%flatten
(function).
+storage-for-deflex-var-seq-cutoff+
(constant).
displace
(function).
ensure-shape
(function).
link
(function).
mutual-element-type
(function).
pairwise
(function).
reduce-between
(function).
reduce-vector-pairwise
(function).
replace*
(function).
seq-cutoff
(symbol macro).
shape=
(function).
shrink-wrap
(function).
void
(function).
serapeum/contrib/hooks
common-lisp
.
combination
(generic reader).
(setf combination)
(generic writer).
combine-composed-hook
(generic function).
combine-hook-until-failure
(generic function).
combine-hook-until-success
(generic function).
default-combine-hook
(generic function).
define-hook
(function).
define-hook-type
(macro).
description
(generic reader).
(setf description)
(generic writer).
disable-hook
(generic function).
disabled-handlers
(generic reader).
(setf disabled-handlers)
(generic writer).
enable-hook
(generic function).
find-handler
(function).
find-hook
(function).
fn
(generic reader).
(setf fn)
(generic writer).
handler
(class).
handler-any
(class).
handler-number->number
(class).
handler-string->string
(class).
handler-type
(generic reader).
(setf handler-type)
(generic writer).
handler-void
(class).
handlers
(generic reader).
(setf handlers)
(generic writer).
hook
(class).
hook-any
(class).
hook-number->number
(class).
hook-string->string
(class).
hook-void
(class).
make-handler-any
(function).
make-handler-number->number
(function).
make-handler-string->string
(function).
make-handler-void
(function).
make-hook-any
(function).
make-hook-number->number
(function).
make-hook-string->string
(function).
make-hook-void
(function).
name
(generic reader).
(setf name)
(generic writer).
place
(generic reader).
(setf place)
(generic writer).
run-hook-with-args-until-failure
(generic function).
run-hook-with-args-until-success
(generic function).
value
(generic reader).
(setf value)
(generic writer).
%hook-table
(special variable).
add-hook-internal
(function).
delete*
(function).
equals
(generic function).
handler-class
(generic reader).
make-handler
(function).
move-hook-handlers
(function).
serapeum/internal-definitions
alexandria
.
common-lisp
.
serapeum
.
%binding
(class).
*internal-definitions-slots*
(special variable).
*subenv*
(special variable).
alias-decls
(generic function).
at-beginning?
(generic function).
augment/block
(function).
augment/funs
(function).
augment/macros
(function).
augment/symbol-macros
(function).
augment/tags
(function).
augment/vars
(function).
binding
(type).
binding-init
(generic reader).
binding-name
(generic reader).
body
(type).
check-beginning
(generic function).
copy-subenv
(function).
define-env-method
(macro).
eject-macro
(generic function).
ensure-var-alias
(generic function).
expand-binding
(function).
expand-bindings
(function).
expand-body
(generic function).
expand-in-env
(generic function).
expand-in-env-1
(generic function).
expand-partially
(generic function).
expand-top
(generic function).
expansion-done
(generic function).
expr
(type).
extract-tagbody-tags
(function).
fun
(function).
fun
(class).
generate-internal-definitions
(generic function).
hoisted-var?
(generic function).
in-subenv?
(generic function).
initialize-binds-from-decls
(function).
internal-definition-form
(type).
internal-definitions-env
(class).
known-var?
(generic function).
let-initialized
(macro).
macro
(function).
macro
(class).
remove-shadowed
(function).
save-symbol-macro
(generic function).
shadow-names
(function).
shadow-symbol-macro
(generic function).
splice-forms
(generic function).
step-expansion
(generic function).
subenv
(function).
subenv
(structure).
subenv-blocks
(reader).
subenv-empty?
(function).
subenv-funs
(reader).
subenv-tags
(reader).
subenv-vars
(reader).
symbol-macro
(function).
symbol-macro
(class).
symbol-macro-bindings
(function).
tagbody-tag?
(function).
var
(function).
var
(class).
var-alias-bindings
(generic function).
visible-of-type
(function).
without-internal-definitions
(macro).
wrap-bindings
(generic function).
wrap-expr
(generic function).
wrap-fn-bindings
(generic function).
serapeum/mop
alexandria
.
closer-common-lisp
.
insert-superclass
(function).
topmost-class
(slot).
topmost-class
(generic reader).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Try to ensure that tail calls will be merged.
If you just want portable self-calls, for writing loops using
recursion, use ‘nlet’ or ‘defloop’ instead.
This may not work at all on some Lisps.
Bypasses macroexpand-time branching of WITH-BOOLEAN. The bypass inhibits all
macroexpand-time branching and instead defers all checks in expanded code to
runtime in the following manner:
* WITH-BOOLEAN -> PROGN
* BOOLEAN-IF -> IF
* BOOLEAN-WHEN -> WHEN
* BOOLEAN-UNLESS -> UNLESS
The hook currently being run.
Declaim the ftype of one or multiple FUNCTIONS from ARGS to VALUES.
(-> mod-fixnum+ (fixnum fixnum) fixnum)
(defun mod-fixnum+ (x y) ...)
(-> (mod-float+ mod-single-float+) (float float) float)
(defun mod-float+ (x y) ...)
(defun mode-single-float+ (x y) ...)
Scheme’s guarded LET* (SRFI-2).
Each clause should have one of the following forms:
- ‘identifier’, in which case IDENTIFIER’s value is tested.
- ‘(expression)’, in which case the value of EXPRESSION is tested.
- ‘(identifier expression)’ in which case EXPRESSION is evaluated,
and, if its value is not false, IDENTIFIER is bound to that value
for the remainder of the clauses and the optional body.
Note that, of course, the semantics are slightly different in Common
Lisp than in Scheme, because our AND short-circuits on null, not
false.
Also, this version makes the bindings immutable.
Macro for inline type checking.
‘assure’ is to ‘the’ as ‘check-type’ is to ‘declare’.
(the string 1) => undefined
(assure string 1) => error
The value returned from the ‘assure’ form is guaranteed to satisfy
TYPE-SPEC. If FORM does not return a value of that type, then a
correctable error is signaled. You can supply a value of the correct
type with the ‘use-value’ restart.
Note that the supplied value is *not* saved into the place designated
by FORM. (But see ‘assuref’.)
Using ‘values’ types is supported, with caveats:
- The types of ‘&rest’ arguments are enforced using ‘soft-list-of’.
- Types defined with ‘deftype’ that expand into values types may not be checked in some Lisps.
From ISLISP.
Like ‘(progn (check-type PLACE TYPE-SPEC) PLACE)‘, but evaluates PLACE only once.
Scheme’s extended COND.
This is exactly like COND, except for clauses having the form
(test :=> recipient)
In that case, if TEST evaluates to a non-nil result, then RECIPIENT, a
function, is called with that result, and the result of RECIPIENT is
return as the value of the ‘cond‘.
As an extension, a clause like this:
(test :=> var ...)
Can be used as a shorthand for
(test :=> (lambda (var) ...))
The name ‘bcond’ for a “binding cond” goes back at least to the days of the Lisp Machines. I do not know who was first to use it, but the oldest examples I have found are by Michael Parker and Scott L. Burson.
Shorthand for block compilation with ‘local*’.
Only the functions in ENTRY-POINTS will have global definitions. All
other functions in BODY will be compiled as purely local functions,
and all of their calls to one another will be compiled as local calls.
This includes calls to the entry points, and even self-calls from
within the entry points.
Note that ‘declaim’ forms occuring inside of BODY will be translated
into local ‘declare’ forms.
If you pass ‘:block-compile nil’, this macro is equivalent to progn. This may be useful during development.
Chooses between the forms to include based on whether a macroexpand-time
branch is true. The first argument must be a symbol naming a branch in the
lexically enclosing WITH-BOOLEAN form.
It is an error to use this macro outside the lexical environment established by WITH-BOOLEAN.
Includes some forms based on whether a macroexpand-time branch is false. The
first argument must be a symbol naming a branch in the lexically enclosing
WITH-BOOLEAN form.
It is an error to use this macro outside the lexical environment established by WITH-BOOLEAN.
Includes some forms based on whether a macroexpand-time branch is true. The
first argument must be a symbol naming a branch in the lexically enclosing
WITH-BOOLEAN form.
It is an error to use this macro outside the lexical environment established by WITH-BOOLEAN.
Set PLACE to the value of calling FUNCTION on PLACE, with ARGS.
Like CALLF, but with the place as the second argument.
Like (let ((VAR EXPR)) (case VAR ...)), with VAR read-only.
Like ‘case’ but may, and must, have an ‘otherwise’ clause.
ISLISP’s case-using.
(case-using #’eql x ...)
≡ (case x ...).
Note that, no matter the predicate, the keys are not evaluated. (But see ‘selector’.)
The PRED form is evaluated.
This version supports both single-item clauses (x ...) and
multiple-item clauses ((x y) ...), as well as (t ...) or (otherwise
...) for the default clause.
Like (let ((VAR EXPR)) (ccase VAR ...)), with VAR correctable.
Like ‘ecase-of’, but providing a ‘store-value’ restart to correct KEYPLACE and try again.
Like ‘case’, but specifically for characters.
Expands into ‘tree-case’.
As an extension to the generalized ‘case’ syntax, the keys of a clause
can be specified as a literal string.
(defun vowel? (c)
(char-case c
("aeiouy" t)))
Signals an error if KEYFORM does not evaluate to a character.
Like ‘ecase’, but specifically for characters. Expands into ‘tree-case’.
Like ‘with-collector’, with the collector bound to the result of interning ‘collect’ in the current package.
A macro that ignores its body and does nothing. Useful for
comments-by-example.
Also, as noted in EXTENSIONS.LISP of 1992, "This may seem like a silly macro, but used inside of other macros or code generation facilities it is very useful - you can see comments in the (one-time) macro expansion!"
Like ‘cond’, but instead of stopping after the first clause that
succeeds, run all the clauses that succeed.
Return the value of the last successful clause.
If a clause begins with ‘cl:otherwise’, it runs only if no preceding
form has succeeded.
Note that this does *not* do the same thing as a series of ‘when’
forms: ‘cond-every’ evaluates *all* the tests *before* it evaluates
any of the forms.
From Zetalisp.
Cross between COND and LET.
(cond-let x ((test ...)))
≡ (let (x)
(cond ((setf x test) ...)))
Cf. ‘acond’ in Anaphora.
Like (let ((VAR EXPR)) (ctypecase VAR ...)), with VAR correctable.
Like ‘etypecase-of’, but providing a ‘store-value’ restart to correct KEYPLACE and try again.
Like ‘def’, with implicit export of VAR.
The famous "deflex".
Define a top level (global) lexical VAR with initial value VAL,
which is assigned unconditionally as with DEFPARAMETER. If a DOC
string is provided, it is attached to both the name |VAR| and the name
*STORAGE-FOR-DEFLEX-VAR-|VAR|* as a documentation string of kind
’VARIABLE. The new VAR will have lexical scope and thus may be
shadowed by LET bindings without affecting its dynamic (global) value.
The original ‘deflex’ is due to Rob Warnock.
This version of ‘deflex’ differs from the original in the following ways:
- It is possible for VAL to close over VAR.
- On implementations that support it (SBCL, CCL, and LispWorks, at the
moment) this version creates a backing variable that is "global" or
"static", so there is not just a change in semantics, but also a
gain in efficiency.
- If VAR is a list that starts with ‘values‘, each element is treated as
a separate variable and initialized as if by ‘(setf (values VAR...)
VAL)‘.
Like ‘defalias’, with implicit export of NAME.
Define a value as a top-level function.
(defalias string-gensym (compose #’gensym #’string))
Like (setf (fdefinition ALIAS) DEF), but with a place to put
documentation and some niceties to placate the compiler.
Note that a function defined with ‘defalias’ is declared ‘notinline’.
This is a matter of semantics: before we can assign to the function,
we must make it assignable (which is what ‘notinline’ means).
Name from Emacs Lisp.
Like ‘defclass’, but implicitly export the name of the class and
the names of all accessors (including readers and writers).
You can specify ‘:export nil’ in the definition of a slot to prevent its accessors from being exported.
Alias for ‘define-condition’.
Like (define-condition ...), but blissfully conforming to the same nomenclatural convention as every other definition form in Common Lisp.
Like ‘defconst’, with implicit export of SYMBOL.
Define a constant, lexically.
‘defconst’ defines a constant using a strategy similar to ‘def’, so
you don’t have to +cage+ your constants.
The constant is only redefined on re-evaluation if INIT has a
different literal representation than the old value.
A constant defined with ‘defconst’ is guaranteed to be available as
soon as it has been defined (for example, for use with reader macros
later in the same file). This is not guaranteed to be portably true
for ‘defconstant’.
The name is from Emacs Lisp.
Like ‘defconstant’, with implicit export of NAME.
A variant of ‘defstruct’ for modeling immutable data.
The structure defined by ‘defconstructor’ has only one constructor,
which takes its arguments as required arguments (a BOA constructor).
Thus, ‘defconstructor’ is only appropriate for data structures that
require no initialization.
The printed representation of an instance resembles its constructor:
(person "Common Lisp" 33)
=> (PERSON "Common Lisp" 33)
While the constructor is BOA, the copier takes keyword arguments,
allowing you to override the values of a selection of the slots of the
structure being copied, while retaining the values of the others.
(defconstructor person
(name string)
(age (integer 0 1000)))
(defun birthday (person)
(copy-person person :age (1+ (person-age person))))
(birthday (person "Common Lisp" 33))
=> (PERSON "Common Lisp" 34)
Obviously the copier becomes more useful the more slots the type has.
When ‘*print-readably*’ is true, the printed representation is
readable:
(person "Common Lisp" 33)
=> #.(PERSON "Common Lisp" 33)
(Why override how a structure is normally printed? Structure types
are not necessarily readable unless they have a default (‘make-X’)
constructor. Since the type defined by ‘defconstructor’ has only one
constructor, we have to take over to make sure it re-readable.)
Besides being re-readable, the type is also externalizable, with a
method for ‘make-load-form’:
(make-load-form (person "Common Lisp" 33))
=> (PERSON "Common Lisp" 33)
Users of Trivia get an extra benefit: defining a type with
‘defconstructor’ also defines a symmetrical pattern for destructuring
that type.
(trivia:match (person "Common Lisp" 33)
((person name age)
(list name age)))
=> ("Common Lisp" 33)
Note that the arguments to the pattern are optional:
(trivia:match (person "Common Lisp" 33)
((person name) name))
=> "Common Lisp"
If you don’t use Trivia, you can still do destructuring with
‘deconstruct’, which returns the slots of a constructor as multiple
values:
(deconstruct (person "Common Lisp" 33))
=> "Common Lisp", 33
Note also that no predicate is defined for the type, so to test for the type you must either use ‘typep’ or pattern matching as above.
While it is possible to inherit from a type defined with
‘defconstructor’ (this is Lisp, I can’t stop you), it’s a bad idea. In
particular, on Lisps which support it, a type defined with
‘defconstructor’ is declared to be frozen (sealed), so your new
subtype may not be recognized in type tests that have already been
compiled.
Because ‘defconstructor’ is implemented on top of
‘defstruct-read-only’, it shares the limitations of
‘defstruct-read-only’. In particular it cannot use inheritance.
The design of ‘defconstructor’ is mostly inspired by Scala’s [case classes](https://docs.scala-lang.org/tour/case-classes.html), with some implementation tricks from ‘cl-algebraic-data-type’.
Like ‘defgeneric’, with implicit export of NAME.
Define a macro like ‘case’.
A case-like macro is one that supports the following syntax:
- A list of keys is treated as matching any key in the list.
- An empty list matches nothing.
- The atoms T or ‘otherwise’ introduce a default clause.
- There can only be one default clause.
- The default clause must come last.
- Any atom besides the empty list, T, or ‘otherwise’ matches itself.
As a consequence of the above, to match against the empty list, T, or
‘otherwise’, they must be wrapped in a list.
(case x
((nil) "Matched nil.")
((t) "Matched t.")
((otherwise) "Matched ‘otherwise’.")
(otherwise "Didn’t match anything."))
A macro defined using ‘define-case-macro’ can ignore all of the above.
It receives three arguments: the expression, already protected against
multiple evaluation; a normalized list of clauses; and, optionally, a
default clause.
The clauses are normalized as a list of ‘(key . body)’, where each key
is an atom. (That includes nil, T, and ‘otherwise’.) Nonetheless, each
body passed to the macro will only appear once in the expansion; there
will be no duplicated code.
The body of the default clause is passed separately,
bound to the value of the ‘:default’ keyword in PARAMS.
(define-case-macro my-case (expr &body clauses)
(:default default)
....)
Note that in this case, ‘default’ will be bound to the clause’s body
– a list of forms – and not to the whole clause. The key of the
default clause is discarded.
If no binding is specified for the default clause, then no default
clause is allowed.
One thing you do still have to consider is the handling of duplicated
keys. The macro defined by ‘define-case-macro’ will reject case sets
that contains duplicate keys under ‘eql’, but depending on the
semantics of your macro, you may need to check for duplicates under a
looser definition of equality.
As a final example, if the ‘case’ macro did not already exist, you
could define it almost trivially using ‘define-case-macro’:
(define-case-macro my-case (expr &body clause)
(:default default)
‘(cond
,@(loop for (key . body) in clauses
collect ‘((eql ,expr ,key) ,@body))
(t ,@body)))
Define an iteration macro like ‘dolist’.
Writing a macro like ‘dolist’ is more complicated than it looks. For
consistency with the rest of CL, you have to do all of the following:
- The entire loop must be surrounded with an implicit ‘nil’ block.
- The body of the loop must be an implicit ‘tagbody’.
- There must be an optional ‘return’ form which, if given, supplies
the values to return from the loop.
- While this return form is being evaluated, the iteration variables
must be bound to ‘nil’.
Say you wanted to define a ‘do-hash’ macro that iterates over hash
tables. A full implementation would look like this:
(defmacro do-hash ((key value hash-table &optional return) &body body)
(multiple-value-bind (body decls) (parse-body body)
‘(block nil
(maphash (lambda (,key ,value)
,@decls
(tagbody
,@body))
,hash-table)
,(when return
‘(let (,key ,value)
,return)))))
Using ‘define-do-macro’ takes care of all of this for you.
(define-do-macro do-hash ((key value hash-table &optional return) &body body)
‘(maphash (lambda (,key ,value)
,@body)
,hash-table))
Define hook class and constructor and the associated handler class.
Type must be something like:
(function (string) (values integer t))
A function with name make-handler-NAME will be created.
A class with name handler-NAME will be created.
The method ‘add-hook’ is added for the new hook and handler types.
The function make-hook-NAME is created. It is similar to (make-instance ’hook-NAME ...) except that named functions are also accepted. Named functions will be automatically encapsulated with make-handler-NAME.
Like ‘define-modify-macro’, but arranges to return the original value.
Like ‘define-symbol-macro’, with implicit export of SYMBOL.
Define a higher-order function and its compiler macro at once.
When defining a higher-order function it is often a good idea to
write a compiler macro so compilers can inline the resulting lambda
form.
For the special case of a fixed-arity function that only takes other
functions as arguments, you can use ‘define-train’ to define the
function and the compiler macro in one go. The catch is that you have
to write the single definition as a macro.
E.g., if ‘complement’ did not exist, you could define it like so:
(define-train complement (fn)
‘(lambda (&rest args)
(not (apply ,fn args))))
Besides providing an implicit compiler macro, ‘define-train’ also
inserts the proper declarations to ensure the compiler recognizes the
function arguments as functions, avoiding runtime type checks.
The term "train" is from J.
Like ‘define-values’, with implicit export of VALUES.
Like ‘def’, but for multiple values.
Each variable in VALUES is given a global, lexical binding, as with
‘def’, then set all at once, as with ‘multiple-value-setq’.
Define a function, ensuring proper tail recursion. This is entirely equivalent to ‘defun’ over ‘nlet’.
Like ‘defmacro’, with implicit export of NAME.
Like ‘defmethod’, with implicit export of NAME.
Concisely define methods that specialize on the same class.
You can already use ‘defgeneric’ to define an arbitrary number of
methods on a single generic function without having to repeat the name
of the function:
(defgeneric fn (x)
(:method ((x string)) ...)
(:method ((x number)) ...))
Which is equivalent to:
(defgeneric fn (x))
(defmethod fn ((x string))
...)
(defmethod fn ((x number))
...)
Similarly, you can use ‘defmethods’ to define methods that specialize
on the same class, and access the same slots, without having to
repeat the names of the class or the slots:
(defmethods my-class (self x y)
(:method initialize-instance :after (self &key)
...)
(:method print-object (self stream)
...)
(:method some-method ((x string) self)
...))
Which is equivalent to:
(defmethod initialize-instance :after ((self my-class) &key)
(with-slots (x y) self
...))
(defmethod print-object ((self my-class) stream)
(with-slots (x y) self
...))
(defmethod some-method ((x string) (self my-class))
(with-slots (y) self ;!
...))
Note in particular that ‘self’ can appear in any position, and that
you can freely specialize the other arguments.
Just as in ‘with-slots’, slots can be renamed:
(defmethods my-class (self (abscissa x) (ordinate y))
...)
You can also use ‘defmethods’ in place of ‘with-accessors’, by using a
function-quote:
(defmethods my-class (self (x #’my-class-x)
(y #’my-class-y))
...)
(The difference from using ‘with-slots’ is the scope of the slot
bindings: they are established *outside* of the method definition,
which means argument bindings shadow slot bindings:
(some-method "foo" (make ’my-class :x "bar"))
=> "foo"
Since slot bindings are lexically outside the argument bindings, this
is surely correct, even if it makes ‘defmethods’ slightly harder to
explain in terms of simpler constructs.)
Is ‘defmethods’ trivial? Yes, in terms of its implementation. This
docstring is far longer than the code it documents. But you may find
it does a lot to keep heavily object-oriented code readable and
organized, without any loss of power.
Note that ‘defmethods’ may also be useful when converting state
machines written using ‘labels’ into an object-oriented style.
This construct is very loosely inspired by impl blocks in Rust.
Like ‘defparameter’, with implicit export of VAR.
Like ‘defvar-unbound’, but ensures VAR is unbound when evaluated.
Define NAME and (SETF NAME) in one go.
BODY is a list of forms, starting with an optional docstring. The last form in BODY, however, must be a single, setf-able expression.
Easily define a defstruct with no mutable slots.
The syntax of ‘defstruct-read-only’ is as close as possible to that of
‘defstruct’. Given an existing structure definition, you can usually
make it immutable simply by switching out ‘defstruct’ for
‘defstruct-read-only’.
There are only a few syntactic differences:
1. To prevent accidentally inheriting mutable slots, and preserve its
own usefulness as a marker of the programmer’s intent,
‘defstruct-read-only’ only allows inheritance from other classes
defined using ‘defstruct-read-only’.
2. The ‘:type’ option may not be used.
3. The ‘:copier’ option is disabled, because it would be useless.
4. Slot definitions can use slot options without having to provide an
initform. In this case, any attempt to make an instance of the
struct without providing a value for that slot will signal an
error.
(my-slot :type string)
≡ (my-slot (required-argument ’my-slot) :read-only t :type string)
The idea here is simply that an unbound slot in an immutable data
structure does not make sense.
A read-only struct is always externalizable; it has an implicit
definition for ‘make-load-form’.
On Lisps that support it, the structure is also marked as "pure":
that is, instances may be moved into read-only memory.
‘defstruct-read-only’ is designed to stay as close to the syntax of ‘defstruct’ as possible. The idea is to make it easy to flag data as immutable, whether in your own code or in code you are refactoring. In new code, however, you may sometimes prefer ‘defconstructor’, which is designed to facilitate working with immutable data.
Define an inline function.
(defsubst fn ...)
≡ (declaim (inline fn))
(defun fn ...)
The advantage of a separate defining form for inline functions is that
you can’t forget to declaim the function inline before defining it –
without which it may not actually end up being inlined.
From Emacs and other ancient Lisps.
Like ‘deftype’, with implicit export of NAME.
Like ‘defun’, with implicit export of NAME.
Define an algebraic data type.
Each expression in VARIANTS is either a symbol (in which case it
defines a unit type, as with ‘defunit’) or a list (in which case it
defines a read-only structure, as with ‘defconstructor’).
UNION is defined as a type equivalent to the disjunction of all the member types. A class is also defined, with the same name, but with angle brackets around it.
Define a unit type.
A unit type is a type with only one instance.
You can think of a unit type as a singleton without state.
Unit types are useful for many of the same purposes as quoted symbols (or keywords) but, unlike a symbol, a unit type is tagged with its own individual type.
Like ‘defvar’, with implicit export of VAR.
Define VAR as if by ‘defvar’ with no init form, and set DOCSTRING
as its documentation.
I believe the name comes from Edi Weitz.
Like ‘destructuring-ecase-of’, but an ‘otherwise’ clause must also be supplied.
Note that the otherwise clauses must also be a list:
((otherwise &rest args) ...)
Like ‘destructuring-case-of’, but providing a ‘store-value’ restart to collect KEYPLACE and try again.
Like ‘destructuring-ecase’, from Alexandria, but with exhaustivness
checking.
TYPE is a designator for a type, which should be defined as ‘(member ...)’. At compile time, the macro checks that, taken together, the symbol at the head of each of the destructuring lists in BODY form an exhaustive partition of TYPE, and warns if it is not so.
A literal hash table.
Like ‘dict’, but the keys and values are implicitly quoted, and the
hash table is inlined as a literal object.
Dispatch on the types of multiple expressions, exhaustively.
Say you are working on a project where you need to handle timestamps represented both as universal times, and as instances of ‘local-time:timestamp’. You start by defining the appropriate types:
(defpackage :dispatch-case-example
(:use :cl :alexandria :serapeum :local-time)
(:shadow :time))
(in-package :dispatch-case-example)
(deftype universal-time ()
’(integer 0 *))
(deftype time ()
’(or universal-time timestamp))
Now you want to write a ‘time=’ function that works on universal
times, timestamps, and any combination thereof.
You can do this using ‘etypecase-of’:
(defun time= (t1 t2)
(etypecase-of time t1
(universal-time
(etypecase-of time t2
(universal-time
(= t1 t2))
(timestamp
(= t1 (timestamp-to-universal t2)))))
(timestamp
(etypecase-of time t2
(universal-time
(time= t2 t1))
(timestamp
(timestamp= t1 t2))))))
This has the advantage of efficiency and exhaustiveness checking, but
the serious disadvantage of being hard to read: to understand what
each branch matches, you have to backtrack to the enclosing branch.
This is bad enough when the nesting is only two layers deep.
Alternately, you could do it with ‘defgeneric’:
(defgeneric time= (t1 t2)
(:method ((t1 integer) (t2 integer))
(= t1 t2))
(:method ((t1 timestamp) (t2 timestamp))
(timestamp= t1 t2))
(:method ((t1 integer) (t2 timestamp))
(= t1 (timestamp-to-universal t2)))
(:method ((t1 timestamp) (t2 integer))
(time= t2 t1)))
This is easy to read, but it has three potential disadvantages. (1)
There is no exhaustiveness checking. If, at some point in the future,
you want to add another representation of time to your project, the
compiler will not warn you if you forget to update ‘time=’. (This is
bad enough with only two objects to dispatch on, but with three or
more it gets rapidly easier to miss a case.) (2) You cannot use the
‘universal-time’ type you just defined; it is a type, not a class, so
you cannot specialize methods on it. (3) You are paying a run-time
price for extensibility – the inherent overhead of a generic function
– when extensibility is not what you want.
Using ‘dispatch-case’ instead gives you the readability of
‘defgeneric’ with the efficiency and safety of ‘etypecase-of’.
(defun time= (t1 t2)
(dispatch-case ((t1 time)
(t2 time))
((universal-time universal-time)
(= t1 t2))
((timestamp timestamp)
(timestamp= t1 t2))
((universal-time timestamp)
(= t1 (timestamp-to-universal t2)))
((timestamp universal-time)
(time= t2 t1))))
The syntax of ‘dispatch-case’ is much closer to ‘defgeneric’ than it
is to ‘etypecase’. The order in which clauses are defined does not
matter, and you can define fallthrough clauses in the same way you
would define fallthrough methods in ‘defgeneric’.
Suppose you wanted to write a ‘time=’ function like the one above, but
always convert times to timestamps before comparing them. You could
write that using ‘dispatch-case’ like so:
(defun time= (x y)
(dispatch-case ((x time)
(y time))
((* universal-time)
(time= x (universal-to-timestamp y)))
((universal-time *)
(time= (universal-to-timestamp x) y))
((timestamp timestamp)
(timestamp= x y))))
(In the list of types, you can use as asterisk as a shorthand for the
type of the corresponding argument to ‘dispatch-case’; in that above,
‘time’.)
Note that this requires only three clauses, where writing it out using nested ‘etypecase-of’ forms would require four clauses. This is a small gain; but with more subtypes to dispatch on, or more objects, such fallthrough clauses become more useful.
Like ‘dispatch-case’, but establish new bindings for each expression.
For example,
(dispatch-case-let (((x string) (expr1))
((y string) (expr2)))
...)
is equivalent to
(let ((x (expr1))
(y (expr2)))
(dispatch-case ((x string)
(y string))
...))
It may be helpful to think of this as a cross between
‘defmethod’ (where the (variable type) notation is used in the lambda
list) and ‘let’ (which has an obvious macro-expansion in terms of
‘lambda’).
Like ‘dispatch-case’, but types in clauses are implicitly wrapped in ‘eql’. The syntax of ‘dispatch-caseql’ is tohus closer to ‘case’ than to ‘typecase’.
Like ‘dispatch-case-let’, but using the clause syntax of ‘dispatch-caseql’.
Iterate over the elements of SEQ, a sequence. If SEQ is a list, this is equivalent to ‘dolist’.
Iterate over hash table TABLE, in no particular order.
At each iteration, a key from TABLE is bound to KEY, and the value of that key in TABLE is bound to VALUE.
For each run of elements in SEQ that does not satisfy SPLIT-FN, call the body with LEFT bound to the start of the run and RIGHT bound to the end of the run.
If ‘split-sequence-if’ did not exist, you could define a simple version trivially with ‘do-splits’ and ‘collecting’:
(defun split-sequence-if (fn seq &key (start 0) end from-end)
(collecting
(do-splits ((l r) (seq fn :start start :end end :from-end from-end))
(collect (subseq seq l r)))))
Providing NOT-AT-END? will bind it as a variable that is T if RIGHT is
not equal to END, and null otherwise. This can be useful when, in
processing a sequence, you want to replace existing delimiters, but do
nothing at the end.
In general ‘do-splits’ will be found useful in situations where you
want to iterate over subsequences in the manner of ‘split-sequence’,
but don’t actually need to realize the sequences.
Like (let ((VAR EXPR)) (ecase VAR ...)), with VAR read-only.
Like ‘ecase’ but, given a TYPE (which should be defined as ‘(member ...)’), warn, at compile time, unless the keys in BODY are all of TYPE and, taken together, they form an exhaustive partition of TYPE.
Exhaustive variant of ‘case-using’.
Like ‘cond’, but signal an error of type ‘econd-failure’ if no clause succeeds.
Like ‘cond-let’ for ‘econd’.
Like ‘cl:if’, but expects two branches.
If there is only one branch a warning is signaled.
This macro is useful when writing explicit decision trees; it will
warn you if you forget a branch.
Short for “exhaustive if”.
Like ‘alexandria:if-let’, but expects two branches. Compare ‘eif’.
Essentially (or place (setf place newval)).
PLACE is treated as unbound if it returns ‘nil’, signals
‘unbound-slot’, or signals ‘unbound-variable’.
Note that ENSURE is ‘setf’-able, so you can do things like
(incf (ensure x 0))
Cf. ‘ensure2’.
Like ‘ensure’, but specifically for accessors that return a second value like ‘gethash’.
Like (let ((VAR EXPR)) (etypecase VAR ...)), with VAR read-only.
Like ‘etypecase’ but, at compile time, warn unless each clause in BODY is a subtype of TYPE, and the clauses in BODY form an exhaustive partition of TYPE.
Shorthand for
(eval-when (:compile-toplevel :load-toplevel :execute) ...)
Emacs’s ‘eval-and-compile’. Alias for ‘eval-always’.
Like ‘comment’.
Like ‘export’, but also evaluated at compile time.
Like ‘export-only’, but also evaluated at compile time.
Binds values in the function namespace.
That is,
(fbind ((fn (lambda () ...))))
≡ (flet ((fn () ...))),
except that a bare symbol in BINDINGS is rewritten as (symbol symbol).
Like ‘fbind’, but creates bindings sequentially.
Like ‘fbind’, but creates recursive bindings.
The consequences of referring to one binding in the expression that generates another are undefined.
Like ‘fbindrec‘, but the function defined in each binding can be used in successive bindings.
Like ‘decf’, but returns the old value instead of the new.
Modify-macro for FILTER.
The place designed by the first argument is set to the result of
calling FILTER with PRED, the place, and ARGS.
Like ‘incf’, but returns the old value instead of the new.
An alternative to using -1 as the starting value of a counter, which can prevent optimization.
Grow the value in a place by a factor.
If TEST evaluates to NIL, evaluate THEN and return its values, otherwise evaluate ELSE and return its values. ELSE defaults to NIL.
Creates new variable bindings, and conditionally executes either
THEN-FORM or ELSE-FORM. ELSE-FORM defaults to NIL.
BINDINGS must be either single binding of the form:
(variable initial-form)
or a list of bindings of the form:
((variable-1 initial-form-1)
(variable-2 initial-form-2)
...
(variable-n initial-form-n))
All initial-forms are executed sequentially in the specified order. Then all
the variables are bound to the corresponding values.
If one of the variables was bound to NIL, the THEN-FORM is executed with the
bindings in effect, otherwise the ELSE-FORM is executed with the bindings in
effect.
Adapted from Alexandria if-let.
DEPRECATED: use ‘alexandria:ignore-some-conditions‘ instead.
Recursive LET.
The idea is that functions created in BINDINGS can close over one
another, and themselves.
Note that ‘letrec’ only binds variables: it can define recursive functions, but can’t bind them as functions. (But see ‘fbindrec’.)
Like LETREC, but the bindings are evaluated in order. See Waddell et al., *Fixing Letrec* for motivation.
Cf. ‘fbindrec*’.
Make internal definitions using top-level definition forms.
Within ‘local’ you can use top-level definition forms and have them create purely local definitions, like ‘let’, ‘labels’, and ‘macrolet’:
(fboundp ’plus) ; => nil
(local
(defun plus (x y)
(+ x y))
(plus 2 2))
;; => 4
(fboundp ’plus) ; => nil
Each form in BODY is subjected to partial expansion (with
‘macroexpand-1’) until either it expands into a recognized definition
form (like ‘defun’) or it can be expanded no further.
(This means that you can use macros that expand into top-level
definition forms to create local definitions.)
Just as at the real top level, a form that expands into ‘progn’ (or an
equivalent ‘eval-when’) is descended into, and definitions that occur
within it are treated as top-level definitions.
(Support for ‘eval-when’ is incomplete: ‘eval-when’ is supported only
when it is equivalent to ‘progn’).
The recognized definition forms are:
- ‘def’, for lexical variables (as with ‘letrec’)
- ‘define-values’, for multiple lexical variables at once
- ‘defun’, for local functions (as with ‘labels’)
- ‘defalias’, to bind values in the function namespace (like ‘fbindrec*’)
- ‘declaim’, to make declarations (as with ‘declare’)
- ‘defconstant’ and ‘defconst’, which behave exactly like symbol macros
- ‘define-symbol-macro’, to bind symbol macros (as with ‘symbol-macrolet’)
Also, with serious restrictions, you can use:
- ‘defmacro’, for local macros (as with ‘macrolet’)
(Note that the top-level definition forms defined by Common Lisp
are (necessarily) supplemented by three from Serapeum: ‘def’,
‘define-values’, and ‘defalias’.)
The exact order in which the bindings are made depends on how ‘local’
is implemented at the time you read this. The only guarantees are that
variables are bound sequentially; functions can always close over the
bindings of variables, and over other functions; and macros can be
used once they are defined.
(local
(def x 1)
(def y (1+ x))
y)
=> 2
(local
(defun adder (y)
(+ x y))
(def x 2)
(adder 1))
=> 3
Perhaps surprisingly, ‘let’ forms (as well as ‘let*’ and
‘multiple-value-bind’) *are* descended into; the only difference is
that ‘defun’ is implicitly translated into ‘defalias’. This means you
can use the top-level idiom of wrapping ‘let’ around ‘defun’.
(local
(let ((x 2))
(defun adder (y)
(+ x y)))
(adder 2))
=> 4
Support for macros is sharply limited. (Symbol macros, on the other
hand, are completely supported.)
1. Macros defined with ‘defmacro’ must precede all other expressions.
2. Macros cannot be defined inside of binding forms like ‘let’.
3. ‘macrolet’ is not allowed at the top level of a ‘local’ form.
These restrictions are undesirable, but well justified: it is
impossible to handle the general case both correctly and portably, and
while some special cases could be provided for, the cost in complexity
of implementation and maintenance would be prohibitive.
The value returned by the ‘local’ form is that of the last form in
BODY. Note that definitions have return values in ‘local’ just like
they do at the top level. For example:
(local
(plus 2 2)
(defun plus (x y)
(+ x y)))
Returns ‘plus’, not 4.
The ‘local’ macro is loosely based on Racket’s support for internal definitions.
Like ‘local’, but leave the last form in BODY intact.
(local*
(defun aux-fn ...)
(defun entry-point ...))
=>
(labels ((aux-fn ...))
(defun entry-point ...))
Return the initial value of the last binding in BINDINGS. The idea
is to create something, initialize it, and then return it.
(lret ((x 1)
(y (make-array 1)))
(setf (aref y 0) x))
=> #(1)
Note that the value returned is the value initially bound. Subsequent
assignments are ignored.
(lret ((x 1))
(setf x 2))
=> 1
Furthermore, on Lisps that support it, the variable may be made
read-only, making assignment a compiler-time error.
‘lret’ may seem trivial, but it fufills the highest purpose a macro
can: it eliminates a whole class of bugs (initializing an object, but
forgetting to return it).
Cf. ‘aprog1’ in Anaphora.
Cf. ‘lret’.
Do pattern matching on an algebraic data type.
UNION should be an algebraic data type.
Each clause in CLAUSES has a pattern as its first element.
If the pattern is a symbol, it matches a unit type.
If the pattern is a list, it matches a constructor.
If the pattern is an underscore, it introduces a default or
fallthrough clause.
If the pattern is a list that starts with ‘or’, it is a disjunction of other patterns.
Parallel (‘let’-like) version of ‘mvlet*’.
Expand a series of nested ‘multiple-value-bind’ forms.
‘mvlet*’ is similar in intent to Scheme’s ‘let-values’, but with a
different and less parenthesis-intensive syntax. Each binding is a
list of
(var var*... expr)
A simple example should suffice to show both the implementation and
the motivation:
(defun uptime (seconds)
(mvlet* ((minutes seconds (truncate seconds 60))
(hours minutes (truncate minutes 60))
(days hours (truncate hours 24)))
(declare ((integer 0 *) days hours minutes seconds))
(fmt "~d day~:p, ~d hour~:p, ~d minute~:p, ~d second~:p"
days hours minutes seconds)))
Note that declarations work just like ‘let*’.
Equivalent to (not (and ...)).
Like ~>>, but backward.
This is useful when layering ‘with-x’ macros where the order is not
important, and extra indentation would be misleading.
For example:
(nest
(with-open-file (in file1 :direction input))
(with-open-file (in file2 :direction output))
...)
Is equivalent to:
(with-open-file (in file1 :direction input)
(with-open-file (in file2 :direction output)
...))
(But see ‘with-open-files’).
If the outer macro has no arguments, you may omit the parentheses.
(nest
with-standard-io-syntax
...)
≡ (with-standard-io-syntax
...)
From UIOP, based on a suggestion by Marco Baringer.
Set PLACES to nil and return the old value(s) of PLACES.
If there is more than one PLACE, return their old values as multiple values.
This may be more efficient than (shiftf place nil), because it only
sets PLACE when it is not already null.
Within BODY, bind NAME as a function, somewhat like LABELS, but
with the guarantee that recursive calls to NAME will not grow the
stack.
‘nlet’ resembles Scheme’s named let, and is used for the same purpose:
writing loops using tail recursion. You could of course do this with
‘labels’ as well, at least under some Lisp implementations, but ‘nlet’
guarantees tail call elimination anywhere and everywhere.
(nlet rec ((i 1000000))
(if (= i 0)
0
(rec (1- i))))
=> 0
Beware: because of the way it is written (literally, a GOTO with
arguments), ‘nlet’ is limited: self calls must be tail calls. That is,
you cannot use ‘nlet’ for true recursion.
The name comes from ‘Let Over Lambda’, but this is a more careful implementation: the function is not bound while the initial arguments are being evaluated, and it is safe to close over the arguments.
Equivalent to (not (or ...)).
From Arc.
Modify macro for NSPLICE-seq.
GOO’s simple macro for positional lambdas.
An OP is like a lambda without an argument list. Within the body of the OP
form, an underscore introduces a new argument.
(reduce (op (set-intersection _ _ :test #’equal))
sets)
You can refer back to each argument by number, starting with _1.
(funcall (op (+ _ _1)) 2) => 4
You can also use positional arguments directly:
(reduce (op (funcall _2 _1)) ...)
Argument lists can be sparse:
(apply (op (+ _1 _3 _5)) ’(1 2 3 4 5)) => 9
Note that OP with a single argument is equivalent to CONSTANTLY:
(funcall (op 1)) => 1
and that OP with a single placeholder is equivalent to IDENTITY:
(funcall (op _) 1) => 1
OP can also be used to define variadic functions by using _* as the
placeholder. It is not necessary to use APPLY.
(apply (op (+ _*)) ’(1 2 3 4)) => 10
OP is intended for simple functions – one-liners. Parameters are
extracted according to a depth-first walk of BODY. Macro expansion
may, or may not, be done depending on the implementation; it should
not be relied on. Lexical bindings may, or may not, shadow
placeholders – again, it depends on the implementation. (This means,
among other things, that nested use of ‘op’ is not a good idea.)
Because of the impossibility of a truly portable code walker, ‘op’
will never be a true replacement for ‘lambda’. But even if it were
possible to do better, ‘op’ would still only be suited for one-liners.
If you need more than a one-liner, then you should be giving your
parameters names.
(One thing you *can* count on is the ability to use ‘op’ with quasiquotes. If using placeholders inside quasiquotes does not work on your Lisp implementation, that’s a bug, not a limitation.)
Like ‘(callf PLACE (op EXPR))’. From GOO.
Like ‘assoc’ but, if there was a match, delete it from ALIST.
From Newlisp.
Modify-macro for prepend. Prepends LISTS to the PLACE designated by the first argument.
Destructively push ITEM to the end of PLACE.
Like ‘push’, but affects the last item rather than the first.
You may want to use ‘enq’ on a ‘queue’ instead.
From LispWorks.
Pushes ITEM to the end of place (like ‘push-end’) but only if it not already a member of PLACE (like ‘pushnew’).
For the use of KEY, TEST, and TEST-NOT, see ‘pushnew’.
Stricter version of ‘multiple-value-bind’.
Use ‘receive’ when you want to enforce that EXPR should return a
certain number of values, or a minimum number of values.
If FORMALS is a proper list, then EXPR must return exactly as many values – no more and no less – as there are variables in FORMALS.
If FORMALS is an improper list (VARS . REST), then EXPR must return at
least as many values as there are VARS, and any further values are
bound, as a list, to REST.
Lastly, if FORMALS is a symbol, bind that symbol to all the values
returned by EXPR, as if by ‘multiple-value-list’.
From Scheme (SRFI-8).
Like ‘case’, but with evaluated keys.
Note that, like ‘case’, ‘select’ interprets a list as the first
element of a clause as a list of keys. To use a form as a key, you
must add an extra set of parentheses.
(select 2
((+ 2 2) t))
=> T
(select 4
(((+ 2 2)) t))
=> T
From Zetalisp.
Like ‘select’, but compare using FN.
Note that (unlike ‘case-using’), FN is not evaluated.
From Zetalisp.
Shrink the value in a place by a factor.
Sort VALUES with PRED and return as multiple values.
Equivalent to
(values-list (sort (list VALUES...) pred))
But with less consing, and potentially faster.
Modify macro for SPLICE-SEQ.
Like ‘let’, except the variables are only initialized once and
retain their values between different invocations of ‘body’.
Every static binding is similar to a ‘let’ binding, except it can have
additional keyword arguments:
- ‘type’ Denotes the type of the variable.
- ‘once’ If true, then binding initialization and mutation will be
thread-safe.
- ‘flush’ If true, this binding will be flushable. Defaults to true.
- ‘in’ Denotes the static binding group in which the binding will be
placed for flushing. Defaults to the value of ‘*package’.
- ‘read-only’ If true, then the binding cannot be mutated with ‘setf’.
Static bindings can be flushed via ‘flush-static-binding-group’ and
‘flush-all-static-binding-groups’; the latter is automatically pushed
into ‘uiop:*dump-image-hooks*’ by Serapeum.
An unflushable static binding will carry its value over into dumped Lisp binaries.
Like ‘let*’, except the variables are only initialized once and
retain their values between different invocations of ‘body’.
Every static binding is similar to a ‘let’ binding, except it can have
additional keyword arguments:
- ‘type’ Denotes the type of the variable.
- ‘once’ If true, then binding initialization and mutation will be
thread-safe.
- ‘flush’ If true, this binding will be flushable. Defaults to true.
- ‘in’ Denotes the static binding group in which the binding will be
placed for flushing. Defaults to the value of ‘*package’.
- ‘read-only’ If true, then the binding cannot be mutated with ‘setf’.
Static bindings can be flushed via ‘flush-static-binding-group’ and
‘flush-all-static-binding-groups’; the latter is automatically pushed
into ‘uiop:*dump-image-hooks*’ by Serapeum.
An unflushable static binding will carry its value over into dumped Lisp binaries.
Like ‘load-time-value’, but signals an error if it cannot preserve identity.
On close reading of the standard, in a function that is evaluated but
not compiled, it is permissible for implementations to repeatedly
execute a ‘load-time-value’ form, and in fact some implementations do
this (including, at the time of writing, ABCL, CLISP, Allegro and
LispWorks).
When ‘static-load-time-value’ is compiled, it behaves exactly like
‘load-time-value’. Otherwise it conducts a run-time check to ensure
that ‘load-time-value’ preserves identity.
Efficient ‘case’-like macro with string keys.
Note that string matching is always case-sensitive.
This uses Paul Khuong’s ‘string-case’ macro internally.
Efficient ‘ecase’-like macro with string keys.
Note that string matching is always case-sensitive.
Cf. ‘string-case’.
Within BODY, bind ‘sum’ to a function that gathers numbers to sum.
If the first form in BODY is a literal number, it is used instead of 0
as the initial sum.
To see the running sum, call ‘sum’ with no arguments.
Return the total.
Run BODY holding a unique lock associated with OBJECT.
If no OBJECT is provided, run BODY as an anonymous critical section.
If BODY begins with a literal string, attach the string to the lock object created (as the argument to ‘bt:make-recursive-lock’).
A variant of ‘case’ optimized for when every key is an integer.
Comparison is done using ‘eql’.
Like ‘tree-case’, but signals an error if KEYFORM does not match any of the provided cases.
Like (let ((VAR EXPR)) (typecase VAR ...)), with VAR read-only.
Like ‘etypecase-of’, but may, and must, have an ‘otherwise’ clause in case X is not of TYPE.
When used globally, same as ‘aref’.
Inside of a with-type-dispatch form, calls to ‘vref’ may be bound to different accessors, such as ‘char’ or ‘schar’, or ‘bit’ or ‘sbit’, depending on the type being specialized on.
Establishes a lexical environment in which it is possible to use
macroexpand-time branching. Within the lexical scope of
‘with-boolean’, it is possible to use ‘boolean-if’, ‘boolean-when’,
and ‘boolean-unless’ to conditionalize whether some forms are included
at compilation time. (You may also use ‘:if’, ‘:when’, or ‘:unless’
for brevity.)
The first argument must be a list of symbols which name variables. This macro will expand into a series of conditionals
Within BODY, bind COLLECTOR to a function of one argument that
accumulates all the arguments it has been called with in order, like
the collect clause in ‘loop’, finally returning the collection.
To see the collection so far, call COLLECTOR with no arguments.
Note that this version binds COLLECTOR to a closure, not a macro: you can pass the collector around or return it like any other function.
Like ‘with-collector’, with multiple collectors.
Returns the final value of each collector as multiple values.
(with-collectors (x y z)
(x 1)
(y 2)
(z 3))
=> ’(1) ’(2) ’(3)
For each of the most common key functions used in sequences, emit a copy of BODY with KEY bound to a local macro that calls KEY-FORM.
If current optimization declarations favor space over speed, or compilation speed over runtime speed, then BODY is only emitted once.
Emit BODY multiple times with specialized, inline versions of ‘member’ bound to TEST-FN.
A simple macro to open one or more files providing the streams for the BODY. The ARGS is a list of ‘(stream filespec options*)‘ as supplied to WITH-OPEN-FILE.
Make VARS read-only within BODY.
That is, within BODY, each var in VARS is bound as a symbol macro,
which expands into a macro whose setf expander, in turn, is defined to
signal a warning at compile time, and an error at run time.
Depending on your Lisp implementation this may or may not do anything, and may or may not have an effect when used on special variables.
Like ‘with-vector-dispatch’ but on implementations that support it, the underlying simple vector of a displaced array is first dereferenced, so the type is guaranteed to be a subtype of simple-array (but not actually ‘simple-vector‘).
START and END are the offset of the original vector’s data in the array it is displaced to.
Like ‘with-standard-io-syntax’, but only bind the variables that
control the reader, not the printer.
This may be preferable to using ‘with-standard-io-syntax’ when loading data, as it will not effect how errors are printed, thus preserving debugging information.
Bind VAR to the character stream designated by STREAM.
STREAM is resolved like the DESTINATION argument to ‘format’: it can
be any of t (for ‘*standard-output*’), nil (for a string stream), a
string with a fill pointer, or a stream to be used directly.
When possible, it is a good idea for functions that build strings to
take a stream to write to, so callers can avoid consing a string just
to write it to a stream. This macro makes it easy to write such
functions.
(defun format-x (x &key stream)
(with-string (s stream)
...))
Like ‘with-subtype-dispatch’ with an overall type of ‘string’.
Like ‘with-type-dispatch’, but SUBTYPES must be subtypes of TYPE.
Furthermore, if SUBTYPES are not exhaustive, an extra clause will be added to ensure that TYPE itself is handled.
A macro-writing macro for the ‘call-with-’ style.
In the ‘call-with-’ style of writing macros, the macro is simply a
syntactic convenience that wraps its body in a thunk and a call to the
function that does the actual work.
(defmacro with-foo (&body body)
‘(call-with-foo (lambda () ,@body)))
The ‘call-with-’ style has many advantages. Functions are easier to
write than macros; you can change the behavior of a function without
having to recompile all its callers; functions can be traced, appear
in backtraces, etc.
But meanwhile, all those thunks are being allocated on the heap. Can
we avoid this? Yes, but at a high cost in boilerplate: the closure has
to be given a name (using ‘flet’) so it can be declared
‘dynamic-extent’.
(defmacro with-foo (&body body)
(with-gensyms (thunk)
‘(flet ((,thunk () ,@body))
(declare (dynamic-extent #’,thunk))
(call-with-foo #’,thunk))))
‘with-thunk’ avoids the boilerplate:
(defmacro with-foo (&body body)
(with-thunk (body)
‘(call-with-foo ,body)))
It is also possible to construct a "thunk" with arguments.
(with-thunk (body foo)
‘(call-with-foo ,body))
≡ ‘(flet ((,thunk (,foo)
,@body))
(declare (dynamic-extent #’,thunk))
(call-with-foo #’,thunk))
Someday this may have a better name.
Specialize BODY on the most common two-arg test functions.
A macro for writing fast sequence functions (among other things).
In the simplest case, this macro produces one copy of BODY for each
type in TYPES, with the appropriate declarations to induce your Lisp
to optimize that version of BODY for the appropriate type.
Say VAR is a string. With this macro, you can trivially emit optimized
code for the different kinds of string that VAR might be. And
then (ideally) instead of getting code that dispatches on the type of
VAR every time you call ‘aref’, you get code that dispatches on the
type of VAR once, and then uses the appropriately specialized
accessors. (But see ‘with-string-dispatch’.)
But that’s the simplest case. Using ‘with-type-dispatch’ also provides *transparent portability*. It examines TYPES to deduplicate types that are not distinct on the current Lisp, or that are shadowed by other provided types. And the expansion strategy may differ from Lisp to Lisp: ideally, you should not have to pay for good performance on Lisps with type inference with pointless code bloat on other Lisps.
There is an additional benefit for vector types. Around each version
of BODY, the definition of ‘vref’ is shadowed to expand into an
appropriate accessor. E.g., within a version of BODY where VAR is
known to be a ‘simple-string’, ‘vref’ expands into ‘schar’.
Using ‘vref’ instead of ‘aref’ is obviously useful on Lisps that do not do type inference, but even on Lisps with type inference it can speed compilation times (compiling ‘aref’ is relatively slow on SBCL).
Within ‘with-type-dispatch’, VAR should be regarded as read-only.
Note that ‘with-type-dispatch’ is intended to be used around
relatively expensive code, particularly loops. For simpler code, the
gains from specialized compilation may not justify the overhead of the
initial dispatch and the increased code size.
Note also that ‘with-type-dispatch’ is relatively low level. You may
want to use one of the other macros in the same family, such as
‘with-subtype-dispatch’, ‘with-string-dispatch’, or so forth.
The design and implementation of ‘with-type-dispatch’ is based on a few sources. It replaces a similar macro formerly included in Serapeum, ‘with-templated-body’. One possible expansion is based on the ‘string-dispatch’ macro used internally in SBCL. But most of the credit should go to the paper "Fast, Maintable, and Portable Sequence Functions", by Irène Durand and Robert Strandh.
Like ‘with-subtype-dispatch’ with an overall type of ‘vector’.
If BODY calls itself, at any depth, signal a (continuable) error of type ‘recursion-forbidden’.
Threading macro from Clojure (by way of Racket).
Thread NEEDLE through HOLES, where each hole is either a
symbol (equivalent to ‘(hole needle)‘) or a list (equivalent to ‘(hole
needle args...)‘).
As an extension, an underscore in the argument list is replaced with the needle, so you can pass the needle as an argument other than the first.
Like ‘~>’ but, by default, thread NEEDLE as the last argument instead of the first.
In the absence of COUNT, expand directly to ‘remove-if-not’.
In the absence of COUNT, expand directly to ‘remove’.
Optimize ‘mvfold’ with a fixed number of seeds.
Optimize ‘mvfoldr’ with a fixed number of seeds.
When there are no initial elements, use the bare constructor, allowing the queue to be declared dynamic-extent.
When LOW and HIGH are both constants, declare the type of the result.
slice
(function).
slot-value-safe
(function).
A concise way of doing lookups in (potentially nested) hash tables.
(@ (dict :x 1) :x) => 1
(@ (dict :x (dict :y 2)) :x :y) => 2
Append an atom to a list.
(append1 list item)
≡ (append list (list item))
The inverse of ARRAY-ROW-MAJOR-INDEX.
Given an array and a row-major index, return a list of subscripts.
(apply #’aref (array-index-row-major i))
≡ (array-row-major-aref i)
Is CHAR an ASCII char?
Like ‘assocdr’ for alists of proper lists.
(assocdr ’x ’((x 1))) => ’(1) (assocadr ’x ’((x 1))) => 1
Like (car (assoc ...))
Like (cdr (assoc ...))
Return SEQ assorted by KEY.
(assort (iota 10)
:key (lambda (n) (mod n 3)))
=> ’((0 3 6 9) (1 4 7) (2 5 8))
Groups are ordered as encountered. This property means you could, in
principle, use ‘assort’ to implement ‘remove-duplicates’ by taking the
first element of each group:
(mapcar #’first (assort list))
≡ (remove-duplicates list :from-end t)
However, if TEST is ambiguous (a partial order), and an element could
qualify as a member of more than one group, then it is not guaranteed
that it will end up in the leftmost group that it could be a member
of.
(assort ’(1 2 1 2 1 2) :test #’<=)
=> ’((1 1) (2 2 1 2))
The default algorithm used by ‘assort’ is, in the worst case, O(n) in the number of groups. If HASH is specified, then a hash table is used instead. However TEST must be acceptable as the ‘:test’ argument to ‘make-hash-table’.
Build a pathname by appending SUFFIXES to BASE.
For ‘path-join-base’, the path on the left is always the *base* and
the path on the right is always the *suffix*. This means that even if
the right hand path is absolute, it will be treated as if it were
relative.
(base-path-join #p"foo/bar" #p"/baz")
=> #p"foo/bar/baz")
Also, a bare file name as a suffix does not override but is appended
to the accumulated file name. This includes the extension.
(base-path-join #p"foo/bar" "baz")
=> #p"foo/barbaz")
(base-path-join #p"foo/bar.x" "baz.y")
=> #p"foo/bar.xbaz.y")
See ‘path-join’ for a similar function with more consistent behavior.
Return SEQ in batches of N elements.
(batches (iota 11) 2)
=> ((0 1) (2 3) (4 5) (6 7) (8 9) (10))
If EVEN is non-nil, then SEQ must be evenly divisible into batches of size N, with no leftovers.
Partial sorting.
Equivalent to (take N (sort SEQ PRED)), but much faster, at least
for small values of N.
With MEMO, use a decorate-sort-undecorate transform to ensure KEY is
only ever called once per element.
The name is from Arc.
Return the index in VEC to insert ITEM and keep VEC sorted.
If a value equivalent to ITEM already exists in VEC, then the index returned is to the left of that existing item.
Return the index in VEC to insert ITEM and keep VEC sorted.
If a value equivalent to ITEM already exists in VEC, then the index returned is to the right of that existing item.
Return a bit vector of the bits in INT. Defaults to little-endian.
SEQ is either empty, or consists entirely of characters that satisfy ‘whitespacep’.
If S is bound, return (values s t). Otherwise, return DEFAULT and nil.
Like ‘(setf (symbol-value SYM) VAL)’, but raises an error if SYM is not already bound.
J’s capped fork (monadic).
Like a monadic fork, but F is omitted.
Effectively the composition of G and H.
J’s capped fork (dyadic).
Like a dyadic fork, but F is omitted.
Given LIST, return its car and cdr as two values.
The car of X, or nil if X is not a cons.
This is different from Alexandria’s ‘ensure-car‘, which returns the atom.
(ensure-car ’(1 . 2)) => 1
(car-safe ’(1 . 2)) => 1
(ensure-car 1) => 1
(car-safe 1) => nil
From Emacs Lisp.
Signal an error of type ‘case-failure’.
The cdr of X, or nil if X is not a cons. From Emacs Lisp.
If STRING ends in one of SUFFIXES, remove that suffix.
SUFFIXES defaults to a Lisp newline, a literal line feed, a literal
carriage return, or a literal carriage return followed by a literal
line feed.
Takes care that the longest suffix is always removed first.
The class name of the class of X.
If X is a class, the name of the class itself.
Return QUEUE’s contents and reset it.
Remove adjacent duplicates in SEQ.
Repetitions that are not adjacent are left alone.
(remove-duplicates ’(1 1 2 2 1 1)) => ’(1 2) (collapse-duplicates ’(1 1 2 2 1 1)) => ’(1 2 1)
Collapse runs of whitespace in STRING.
Each run of space, newline, and other whitespace characters is
replaced by a single space character (or SPACE, if that is specified).
Abbreviation for (concatenate ’string ...).
From Emacs Lisp.
Like COPY-LIST, but copies at most the first N conses of LIST. Handles cyclic lists gracefully.
Copy QUEUE as another queue.
Try very hard to return a meaningful count of CPUs.
If ONLINE is non-nil, try to return only the active CPUs.
The second value is T if the number of processors could be queried,
‘nil’ otherwise.
If MEMOIZE is non-nil (default), then memoize the result. Calling with MEMOIZE nil clears any memoized results.
Is YEAR a leap year in the Gregorian calendar?
If X is a type defined with ‘defconstructor’, return its slots as multiple values.
Return a globally-accessible hook.
The hook can be accessed with ‘find-hook’ at (list NAME OBJECT).
Return TABLE with KEYS removed (as with ‘remhash’). Cf. ‘delete-from-plist’ in Alexandria.
Like (delete ... :test #’eq), but only for lists.
Almost always used as (delq nil ...).
Return the successive differences in SEQ.
(deltas ’(4 9 -5 1 2))
=> ’(4 5 -14 6 1)
Note that the first element of SEQ is also the first element of the
return value.
By default, the delta is the difference, but you can specify another
function as a second argument:
(deltas ’(2 4 2 6) #’/)
=> ’(2 2 1/2 3)
From Q.
Remove item from the front of the QUEUE.
A concise constructor for hash tables.
(gethash :c (dict :a 1 :b 2 :c 3)) => 3, T
By default, return an ’equal hash table containing each successive
pair of keys and values from KEYS-AND-VALUES.
If the number of KEYS-AND-VALUES is odd, then the first argument is
understood as the test.
(gethash "string" (dict "string" t)) => t
(gethash "string" (dict ’eq "string" t)) => nil
Note that ‘dict’ can also be used for destructuring (with Trivia).
(match (dict :x 1)
((dict :x x) x))
=> 1
Merge new bindings into DICT.
Roughly equivalent to ‘(merge-tables DICT (dict args...))’.
Return a closure returning only values it has not seen before.
(defalias test (distinct))
(test ’foo) => foo, t
(test ’foo) => nil, nil
The second value is T when the value is distinct.
TEST must be a valid test for a hash table.
This has many uses, for example:
(count-if (distinct) seq)
≡ (length (remove-duplicates seq))
If SYNCHRONIZED is non-nil, then ‘distinct’ can safely be used from
multiple threads. Otherwise it is not thread-safe.
Note the closure returned by ‘distinct’ changes how it tracks unique items based on the number of items it is tracking, so it is suitable for all sizes of set.
Do nothing and return nothing.
This function is meant as a placeholder for a function argument.
From LispWorks.
Return all but the first N elements of SEQ.
The sequence returned is a new sequence of the same type as SEQ.
If N is greater than the length of SEQ, returns an empty sequence of
the same type.
If N is negative, then |N| elements are dropped from the end of SEQ.
If SEQ starts with PREFIX, remove it.
If SEQ ends with SUFFIX, remove it.
Like ‘drop-while’ with the complement of PRED.
Return the largest possible suffix of SEQ for which PRED returns false when called on the first element.
Decorate-sort-undecorate using KEY.
Useful when KEY is an expensive function (e.g. database access).
Like ‘dsu-sort’, but returning a new vector.
Create a dynamic closure.
Some ancient Lisps had closures without lexical binding. Instead, you
could "close over" pieces of the current dynamic environment. When
the resulting closure was called, the symbols closed over would be
bound to their storage at the time the closure was created. These
bindings would persist through subsequent invocations and could be
mutated. The result was something between a closure and a
continuation.
This particular piece of Lisp history is worth reviving, I think, if
only for use with threads. For example, to start a thread and
propagate the current value of ‘*standard-output*’:
(bt:make-thread (dynamic-closure ’(*standard-output*) (lambda ...)))
= (let ((temp *standard-output*))
(bt:make-thread
(lambda ...
(let ((*standard-output* temp))
...))))
The left refers to the position of the array.
Destructively remove only the first occurence of ITEM in LIST.
From Lisp 1.5.
If STRING is longer than N, truncate it and append ELLIPSIS.
Note that the resulting string is longer than N by the length of
ELLIPSIS, so if N is very small the string may come out longer than it
started.
(ellipsize "abc" 2)
=> "ab..."
From Arc.
Insert ITEM at the end of QUEUE.
Return a sequence like SEQ, but starting with PREFIX. If SEQ already starts with PREFIX, return SEQ.
Return a sequence like SEQ, but ending with SUFFIX. If SEQ already ends with SUFFIX, return SEQ.
If X is a vector, return it.
Otherwise, return a vector with X as its sole element.
Variadic version of ‘eq’.
With no arguments, return T.
With one argument, return T.
With two arguments, same as ‘eq’.
With three or more arguments, return T only if all of XS are
equivalent under ‘eq’.
Has a compiler macro, so there is no loss of efficiency relative to writing out the tests by hand.
Variadic version of ‘eql’.
With no arguments, return T.
With one argument, return T.
With two arguments, same as ‘eql’.
With three or more arguments, return T only if all of XS are
equivalent under ‘eql’.
Has a compiler macro, so there is no loss of efficiency relative to writing out the tests by hand.
Return a one-argument function that tests if its argument is ‘eql’ to X.
Return a one-argument function that tests if its argument is ‘eq’ to X.
Variadic version of ‘equal’.
With no arguments, return T.
With one argument, return T.
With two arguments, same as ‘equal’.
With three or more arguments, return T only if all of XS are
equivalent under ‘equal’.
Has a compiler macro, so there is no loss of efficiency relative to writing out the tests by hand.
Variadic version of ‘equalp’.
With no arguments, return T.
With one argument, return T.
With two arguments, same as ‘equalp’.
With three or more arguments, return T only if all of XS are
equivalent under ‘equalp’.
Has a compiler macro, so there is no loss of efficiency relative to writing out the tests by hand.
Return a one-argument function that tests if its argument is ‘equal’ to X.
Write STRING to STREAM, escaping with TABLE.
TABLE should be either a hash table, with characters for keys and
strings for values, or a function that takes a character and
returns (only) either a string or null.
That is, the signature of TABLE should be:
(function (character) (or string null))
where ‘nil’ means to pass the character through unchanged.
STREAM can be used to specify a stream to write to, like the first argument to ‘format’. The default behavior, with no stream specified, is to return a string.
Try to reduce FORM to a constant, using ENV.
If FORM cannot be reduced, return it unaltered.
Also return a second value, T if the form could be reduced to a
constant, or nil otherwise. (Note that the second value may be T if
FORM was already a constant; think of it as a "green light" to treat
the value as a constant.)
This is equivalent to testing if FORM is constant, then evaluating it,
except that FORM is macro-expanded in ENV (taking compiler macros into
account) before doing the test.
Note that this function may treat a form as constant which would not be recognized as such by ‘constantp’, because we also expand compiler macros.
If P, a pathname designator, has no extension, then, on Windows only, add an extension of ‘.exe‘.
Like ‘macroexpand-1’, but also expand compiler macros. From Swank.
Like ‘macroexpand’, but also expand compiler macros. From Swank.
Sanity-check EXP, a macro expansion, assuming it is supposed to be a series of forms suitable for splicing into a progn (implicit or explicit.)
Sanity-check EXP, a macro expansion, assuming it is supposed to be a single form suitable for inserting intact.
Like EXPORT, but unexport any other, existing exports.
Like EXTREMUM, but returns both the minimum and the maximum (as two
values).
(extremum (iota 10) #’>) => 9
(extrema (iota 10) #’>) => 9, 0
The size of FILE, in units of ELEMENT-TYPE (defaults to bytes).
The size is computed by opening the file and getting the length of the
resulting stream.
If all you want is to read the file’s size in octets from its metadata, consider ‘trivial-file-size:file-size-in-octets’ instead.
Format the size of FILE (in octets) using ‘format-file-size-human-readable’.
The size of file is found by ‘trivial-file-size:file-size-in-octets’.
Inspired by the function of the same name in Emacs.
Compare FILE1 and FILE2 octet by octet, (possibly) using buffers of BUFFER-SIZE.
Almost, but not quite, an alias for ‘remove-if-not’.
The difference is the handling of COUNT: for ‘filter’, COUNT is the
number of items to *keep*, not remove.
(remove-if-not #’oddp ’(1 2 3 4 5) :count 2)
=> ’(1 3 5)
(filter #’oddp ’(1 2 3 4 5) :count 2)
=> ’(1 3)
Map FN over (LIST . LISTS) like ‘mapcar’, but omit empty results.
(filter-map fn ...)
≅ (remove nil (mapcar fn ...))
The class designated by X.
If X is a class, it designates itself.
If PACKAGE exports a symbol named STRING, return it.
If PACKAGE does not contain such a symbol, or if the symbol is not
exported, then ‘nil’ is returned, unless ERROR is non-nil, in which
case an error is signaled.
Return handler matching HANDLER-OR-NAME in HANDLERS sequence.
Return the global hook with name NAME associated to OBJECT, if provided.
The following examples return different hooks:
- (find-hook ’foo-hook)
- (find-hook ’foo-hook ’bar-class)
- (find-hook ’foo-hook (make-instance ’bar-class))
If STRING has been interned as a keyword, return it.
Like ‘make-keyword’, but preferable in most cases, because it doesn’t intern a keyword – which is usually both unnecessary and unwise.
The first N elements of LIST, as a fresh list:
(firstn 4 (iota 10))
=> (0 1 2 4)
(I do not know why this extremely useful function did not make it into Common Lisp, unless it was deliberately left out as an exercise for Maclisp users.)
Same as ‘(typep N ’fixnum)’.
Flip around the arguments of a binary function.
That is, given a binary function, return another, equivalent function
that takes its two arguments in the opposite order.
From Haskell.
Return a table like TABLE, but with keys and values flipped.
(gethash :y (flip-hash-table (dict :x :y)))
=> :x, t
TEST allows you to filter which keys to set.
(def number-names (dictq 1 one 2 two 3 three))
(def name-numbers (flip-hash-table number-names))
(def name-odd-numbers (flip-hash-table number-names :filter #’oddp))
(gethash ’two name-numbers) => 2, t
(gethash ’two name-odd-numbers) => nil, nil
KEY allows you to transform the keys in the old hash table.
(def negative-number-names (flip-hash-table number-names :key #’-))
(gethash ’one negative-number-names) => -1, t
KEY defaults to ‘identity’.
Perform numeric contagion on the elements of NS.
That is, if any element of NS is a float, then every number in NS will
be returned as "a float of the largest format among all the
floating-point arguments to the function".
This does nothing but numeric contagion: the number of arguments returned is the same as the number of arguments given.
Flush all static binding values in ALL binding groups and
restore them to their uninitialized state, forcing any initforms
for these static bindings to be reevaluated whenever control
next reaches the respective ‘static-let’/‘static-let*’. Returns the
number of live bindings flushed that way.
This operation is unsafe to perform while any other threads are
trying to access these bindings; proper synchronization is left
to the user. In addition, this operation will clear ALL values,
including these which were not bound by the programmer. This can
lead to unintended behavior, hence, a continuable error is signaled
unless Lisp is running single-threaded.
This function is useful e.g. when deploying Lisp binaries in order to not include static binding values in the resulting Lisp image.
Note that a static binding that was created as ‘:flushablep nil’ will not be affected by this operation.
Flushes all static binding values in binding group ‘group’ and
restores them to their uninitialized state, forcing any initforms
for these static bindings to be reevaluated whenever control
next reaches the respective ‘static-let’/‘static-let*’. Returns the
number of live bindings flushed that way.
This operation is unsafe to perform while any other threads are
trying to access these bindings; proper synchronization is left
to the user. Therefore, a continuable error is signaled unless
Lisp is running single-threaded or ‘are-you-sure-p’ is true.
Note that a static binding that was created as ‘:flushablep nil’ will not be affected by this operation.
A cousin of ‘format‘ expressly for fast formatting of strings.
Like (format nil ...), binding ‘*print-pretty*’ to ‘nil’, which in
some Lisps means a significant increase in speed.
Has a compiler macro with ‘formatter’.
Return a function that ORs its arguments with DEFAULTS.
If the first argument is nil, then the first default in DEFAULTS is used instead; if the second argument is nil, then the second default in DEFAULTS is used instead; and so on until we run out of DEFAULTS.
The minimum arity is equal to the length of DEFAULTS.
This has a compiler macro for reasonable efficiency.
From Clojure.
Monadic fork.
The monadic fork of f, g, and h is defined as
(f g h) y <-> (f y) g (h y)
The usual example of a monadic fork is defining the mean. Assuming a
‘sum’ function defined as
(defun sum (xs)
(reduce #’+ xs))
you can write a (numerically unstable) ‘mean’ using ‘fork’.
(fork #’/ #’sum #’length)
(funcall * ’(1.0 2.0 3.0 4.0))
=> 2.5
From J.
Dyadic fork.
The dyadic fork of f, g, and h is defined as:
x (f g h) y <-> (x f y) g (x h y)
For example, say you wanted a "plus or minus" operator. Given
numbers x and y, it returns a list of x+y and x-y. This can easily be
written as a dyadic fork.
(fork2 #’list #’+ #’-)
(funcall * 10 2)
=> ’(12 8)
From J.
Write FILE-SIZE, a file size in bytes, to STREAM, in human-readable form.
STREAM is interpreted as by ‘format’.
If FLAVOR is nil, kilobytes are 1024 bytes and SI prefixes are used.
If FLAVOR is ‘:si’, kilobytes are 1000 bytes and SI prefixes are used.
If FLAVOR is ‘:iec’, kilobytes are 1024 bytes and IEC prefixes (Ki,
Mi, etc.) are used.
If SPACE is non-nil, include a space between the number and the
prefix. (Defaults to T if FLAVOR is ‘:si’.)
SUFFIX is the suffix to use; defaults to B if FLAVOR is ‘:iec’, otherwise empty.
Write SIZE to STREAM, in human-readable form.
STREAM is interpreted as by ‘format’.
If FLAVOR is ‘:si’ (the default) the base is 1000 and SI prefixes are used.
If FLAVOR is ‘:file’, the base is 1024 and SI prefixes are used.
If FLAVOR is ‘:iec’, the base is 1024 bytes and IEC prefixes (Ki, Mi,
etc.) are used.
If SPACE is non-nil, include a space between the number and the
prefix. (Defaults to T if FLAVOR is ‘:si’.)
Return a hash table with the count of each unique item in SEQ.
As a second value, return the length of SEQ.
From Clojure.
The first element in QUEUE.
Return a function to count ’fuel’ consumption down from the initial level.
The function takes one argument and subtracts its value from the
current fuel level.
The two return values are a boolean indicating whether the available fuel has been exceeded followed by the current fuel level (which may be negative.)
The greatest common prefix of SEQS.
If there is no common prefix, return NIL.
The greatest common suffix of SEQS.
If there is no common suffix, return NIL.
The current time as a count of seconds from the Unix epoch.
Increase N by a factor.
Return, as two values, the first and second halves of SEQ.
SPLIT designates where to split SEQ; it defaults to half the length,
but can be specified.
If SPLIT is not provided, the length is halved using ‘ceiling’ rather
than ‘truncate’. This is on the theory that, if SEQ is a
single-element list, it should be returned unchanged.
If SPLIT is negative, then the split is determined by counting |split| elements from the right (or, equivalently, length+split elements from the left). Note that providing a negative argument to a list works similarly to ‘butlast’ (a single traversal).
Reduce TABLE by calling FN with three values: a key from the hash
table, its value, and the return value of the last call to FN. On the
first call, INIT is supplied in place of the previous value.
From Guile.
Return a function for accessing HASH-TABLE.
Calling the function with a single argument is equivalent to ‘gethash’
against a copy of HASH-TABLE at the time HASH-TABLE-FUNCTION was
called.
(def x (make-hash-table))
(funcall (hash-table-function x) y)
≡ (gethash y x)
If READ-ONLY is nil, then calling the function with two arguments is
equivalent to ‘(setf (gethash ...))’ against HASH-TABLE.
If STRICT is non-nil, then the function signals an error if it is
called with a key that is not present in HASH-TABLE. This applies to
setting keys, as well as looking them up.
The function is able to restrict what types are permitted as keys and values. If KEY-TYPE is specified, an error will be signaled if an attempt is made to get or set a key that does not satisfy KEY-TYPE. If VALUE-TYPE is specified, an error will be signaled if an attempt is made to set a value that does not satisfy VALUE-TYPE. However, the hash table provided is *not* checked to ensure that the existing pairings KEY-TYPE and VALUE-TYPE – not unless STRICT-TYPES is also specified.
Return a predicate for membership in HASH-TABLE.
The predicate returns the same two values as ‘gethash’, but in the
opposite order.
Return the set denoted by TABLE.
Given STRICT, check that the table actually denotes a set.
Without STRICT, equivalent to ‘hash-table-values’.
Is TEST a valid hash table test?
Destructively extract the element in heap at index I, counting from the greatest element.
Destructively extract all the elements of HEAP from greatest to least.
Destructively extract the greatest element of HEAP.
Insert NEW-ITEM into HEAP.
Return (without extracting) the greatest element in HEAP.
Monadic hook.
From J.
The hook of f is defined as f(y,g(y)).
For example, you can use a hook to test whether a number is an
integer, by asking whether it is equal to its own floor.
(hook #’= #’floor)
(funcall * 2.0)
=> T
AKA Schoenfinkel’s S combinator.
Dyadic hook.
The usual (only?) example of a dyadic hook is an ‘hour’ function that
takes an hour and a count of minutes and returns a fractional count of
hours.
(hook2 #’+ (partial (flip #’/) 60))
(funcall * 3.0 15.0)
=> 3.25
From J.
A concise way of doing lookups in (potentially nested) hash tables.
(href (dict :x 1) :x) => 1
(href (dict :x (dict :y 2)) :x :y) => 2
Like ‘href’, with a default.
As soon as one of KEYS fails to match, DEFAULT is returned.
Auxiliary function for formatting quantities human-readably. Returns two values: a format control and a list of arguments.
This can be used to integrate the human-readable printing of
quantities into larger format control strings using the recursive
processing format directive (~?):
(multiple-value-bind (control args)
(human-size-formatter size)
(format t "~?" control args))
Is X equal to any of ITEMS?
‘(in x xs...)‘ is always equivalent to ‘(and (member x xs :test equal) t)‘,
but ‘in‘ can sometimes compile to more efficient code when the
candidate matches are constant.
From Arc.
Return T if LIST1 and LIST2 intersect.
Equivalent to ‘(and (intersection list1 list2) t)‘, without
intermediate consing.
Two empty lists are not considered to intersect.
Return a sequence like SEQ, but with NEW-ELT inserted between each element.
A verbose but readable way of specifying intervals in seconds.
Intended as a more readable alternative to idioms
like (let ((day-in-seconds #.(* 24 60 60))) ...)
Has a compiler macro.
Clojure’s ‘juxt’.
Return a function which returns a list where each element is the
result of applying one of FNS to the arguments.
It’s actually quite simple, but easier to demonstrate than to explain.
The classic example is to use ‘juxt‘ to implement ‘partition‘:
(defalias partition* (juxt #’filter #’remove-if))
(partition* #’evenp ’(1 2 3 4 5 6 7 8 9 10))
=> ’((2 4 6 8 10) (1 3 5 7 9))
The general idea is that ‘juxt‘ takes things apart.
Almost, but not quite, an alias for ‘remove‘ with ‘:test-not‘ instead of ‘:test‘.
The difference is the handling of COUNT. For keep, COUNT is the number of items to keep, not remove.
(remove ’x ’(x y x y x y) :count 2)
=> ’(y y x y)
(keep ’x ’(x y x y x y) :count 2)
=> ’(x x)
‘keep’ becomes useful with the KEY argument:
(keep ’x ((x 1) (y 2) (x 3)) :key #’car)
=> ’((x 1) (x 3))
Call FN on each leaf of TREE.
Return a new tree possibly sharing structure with TREE.
Call FUN on each leaf of TREE.
Is each length-designator in SEQS shorter than the next? A length designator may be a sequence or an integer.
Is each length-designator in SEQS as long or shorter than the next? A length designator may be a sequence or an integer.
Is each length-designator in SEQS longer than the next? A length designator may be a sequence or an integer.
Is each length-designator in SEQS longer or as long as the next? A length designator may be a sequence or an integer.
Return a list of the lines in STRING, stripped of any EOL characters
and including the last nonempty line even if it has no EOL characters,
or NIL if STRING is empty or NIL.
If COUNT is provided, only the first COUNT lines are returned.
EOL-STYLE can be one of the following:
- NIL, the default, which means split on #\Newline.
- :CR, which means split on CR, i.e., #\Return.
- :LF, which means split on LF, i.e., #\Linefeed.
- :CRLF, which means split on CRLF, i.e., #\Return followed by
#\Linefeed.
- :ASCII, which means split on any of CR, LF, and CRLF.
- :UNICODE, which means split on any of the newlines described in
Section 5.8, "Newline Guidelines", of the Unicode Standard,
available at http://www.unicode.org/versions/latest/.
These newlines are CR, LF, CRLF, next line, vertical tab, form feed,
line separator, and paragraph separator.
- A predicate that accepts one CHARACTER and returns non-NIL if the
CHARACTER should be split on, NIL otherwise.
:CR, :LF, :CRLF, and :ASCII assume that the Common Lisp implementation
represents CHARACTERs internally as ASCII or one of its supersets
(e.g., extended ASCII), and :UNICODE assumes that it represents them
internally as Unicode (which is also a superset of ASCII).
Additionally, all of the EOL-STYLEs just mentioned assume that #\Newline
is either #\Return or #\Linefeed (which can be reasonably expected).
If HONOR-CRLF is supplied, it overrides EOL-STYLE’s interpretation of
CRLF except if EOL-STYLE is NIL or :CRLF, in which case HONOR-CRLF has
no effect.
(The :CRLF, :ASCII and :UNICODE EOL-STYLEs honor CRLF by default; the
rest do not.)
If KEEP-EOLS is non-NIL, LINES does not strip the EOL characters from
the lines.
Note that Common Lisp implementations may convert some or all of CR, LF,
and CRLF to #\Newline when reading from file streams, which causes
LINES to split the contents of files differently across implementations.
:CR, :LF, and :CRLF are suitable only when STRING’s lines certainly end
with the corresponding EOL character, but if STRING originates from a
file stream, LINES splits nothing unless the corresponding EOL character
is the same as #\Newline, in which case LINES behaves as if EOL-STYLE
were NIL (and indeed NIL is preferable to :CR, :LF, and :CRLF, though
not to :ASCII and :UNICODE).
:UNICODE and :ASCII are the preferred EOL-STYLEs, the former to be
maximally portable and correct, and the latter when Unicode is inapt.
With either EOL-STYLE, LINES splits the entire contents of files
correctly only when the Common Lisp implementation converts only CR,
only LF, or all of CR, LF, and CRLF, to #\Newline (and when it
converts only CR or only LF, #\Newline must the same as the EOL
character in question).
Again with either EOL-STYLE, LINES splits the lines of files, read with
READ-LINE, correctly only when the implementation converts only LF or
all of CR, LF, and CRLF to #\Newline (which must be #\Linefeed).
(Note the lack of the only-CR case when reading files line by line.)
However, any incorrect behavior with :ASCII and :UNICODE is limited to
LINES returning too many or too few empty lines.
The former – which is uncorrectable – can occur when CR and LF are
converted, but not CRLF, and the latter – which can be corrected by
supplying HONOR-CRLF as NIL – when CR and CRLF are converted (to
#\Return), but not LF, or when LF and CRLF are converted (to
#\Linefeed), but not CR.
For example, to split lines on LF and CRLF (eschewing the recommended
:ASCII and :UNICODE) when the Common Lisp implementation converts only
LF to #\Newline (which must be #\Linefeed), which is the same
behavior as Rust’s std::io::BufRead.lines
(https://doc.rust-lang.org/std/io/trait.BufRead.html#method.lines) and
Go’s bufio.ScanLines (https://golang.org/pkg/bufio/#ScanLines):
#.(ecase #\Newline (#\Linefeed))
(let ((string (coerce ’(#\a #\Return
#\b #\Linefeed
#\c #\Return #\Linefeed
#\d)
’string)))
(serapeum:lines string :eol-style :lf :honor-crlf t))
=> ("a^Mb" "c" "d")
;; where ^M is #\Return.
(EOL-STYLE cannot be NIL here because otherwise HONOR-CRLF would have
no effect.)
To split lines in the same way as Python’s str.splitlines
(https://docs.python.org/3/library/stdtypes.html#str.splitlines) when
the Common Lisp implementation converts only CR, only LF, or all of CR,
LF, and CRLF, to #\Newline (as previously described), but also keeping
the EOL characters in order to know what they were:
#.(ecase #\Newline ((#\Return #\Linefeed)))
;; Omit file separator from the example because its textual
;; representation (^\) can confuse documentation browsers.
(let ((string (coerce ’(#\a #.(code-char #x001D)
#\b #.(code-char #x001E)
#\c)
’string)))
(serapeum:lines
string
:eol-style (lambda (c)
(serapeum:in
c #\Return #\Linefeed
#.(code-char #x000B) ; #\Vt (vertical tab)
#\Page ; Form feed
#.(code-char #x001C) ; #\Fs (file separator)
#.(code-char #x001D) ; #\Gs (group separator)
#.(code-char #x001E) ; #\Rs (record separator)
#.(code-char #x0085) ; Next line
#.(code-char #x2028) ; #\Line_Separator
#.(code-char #x2029))) ; #\Paragraph_Separator
:honor-crlf t
:keep-eols t))
=> ("a^]" "b^^" "c")
;; where ^] is group separator and ^^ is record separator.
To omit empty lines (thus uniformizing LINES’s behavior across Common
Lisp implementations):
#.(ecase #\Newline ((#\Return #\Linefeed)))
(let ((string (coerce ’(#\a #\b #\c
#\Return #\Return #\Linefeed #\Linefeed
#\z)
’string)))
(delete-if #’uiop:emptyp (serapeum:lines string :eol-style :unicode)))
=> ("abc" "z")
To additionally omit lines consisting only of whitespace:
#.(ecase #\Newline ((#\Return #\Linefeed)))
(let ((string (coerce ’(#\a #\b #\c
#\Return #\Return #\Linefeed #\Linefeed
#\Space #\Linefeed
#\Tab #\Linefeed
#\z)
’string)))
(delete-if #’uiop:emptyp
(mapcar #’serapeum:trim-whitespace
(serapeum:lines string :eol-style :unicode))))
=> ("abc" "z")
Return the longer of X and Y.
If X and Y are of equal length, return X.
If X and Y are lists, this will only traverse the shorter of X and Y.
Return the longest seq in SEQS.
If there are lists in SEQS, then the total number of conses traversed will never exceed n*m, where n is the number of lists in SEQS and m is the length of the next-to-longest list (unless the longest list is not unique!).
Shorthand for ‘make-instance’.
Unlike ‘make-instance’, this is not a generic function, so it can do
more compile-time argument checking.
Also unlike ‘make-instance’, ‘make’ is defined to always return a single value. It also declares its return type (as ‘standard-object’, or also ‘structure-object’ if the implementation allows ‘make-instance’ on structures). This may allow the compiler to warn you if you (e.g.) try to treat the return value as a list or number.
After Eulisp.
Call ‘hash-table-function’ on a fresh hash table. ARGS can be args to ‘hash-table-function’ or args to ‘make-hash-table’, as they are disjoint.
Make hook and return it.
HANDLERS can also contain named functions.
Those will automatically be encapsulated with MAKE-HANDLER-ANY.
Make hook and return it.
HANDLERS can also contain named functions.
Those will automatically be encapsulated with MAKE-HANDLER-NUMBER->NUMBER.
Make hook and return it.
HANDLERS can also contain named functions.
Those will automatically be encapsulated with MAKE-HANDLER-STRING->STRING.
Make hook and return it.
HANDLERS can also contain named functions.
Those will automatically be encapsulated with MAKE-HANDLER-VOID.
Make an octet vector of SIZE elements.
Walk FUN over TREE and build a tree from the results.
The new tree may share structure with the old tree.
(eq tree (map-tree #’identity tree)) => T
FUN can skip the current subtree with (throw TAG SUBTREE), in which
case SUBTREE will be used as the value of the subtree.
TRAVERSE can be one of ‘:preorder’, ‘:postorder’, or ‘:inorder’. The default is ‘:preorder’.
Like (map-into list fn list).
From PAIP.
Build a string by mapping FUN over SEQ.
Separate each value with SEPARATOR.
Equivalent to
(reduce #’concat (intersperse SEP SEQ) :key FUN)
but more efficient.
STREAM can be used to specify a stream to write to. It is resolved
like the first argument to ‘format’.
From Emacs Lisp.
Map FN over SEQS, updating HASH-TABLE with the results. Return HASH-TABLE.
FN is required to return two values, and key and a value.
Like MAPHASH, but builds and returns a new hash table.
FN is a function of two arguments, like the function argument to
‘maphash’. It is required, however, to return two values, a new key
and a new value.
If ‘copy-hash-table’ did not exist, you could define it as:
(maphash-new #’values hash-table)
Note it is not necessarily the case that the new hash table will have
the same number of entries as the old hash table, since FN might
evaluate to the same key more than once.
By default, the new hash table has the same hash table
properties (test, size) as HASH-TABLE, but these can be overridden
with HASH-TABLE-ARGS.
Like MAPHASH, but collect and return the values from FN. From Zetalisp.
‘mapply’ is a cousin of ‘mapcar’.
If you think of ‘mapcar’ as using ‘funcall’:
(mapcar #’- ’(1 2 3))
≅ (loop for item in ’(1 2 3)
collect (funcall #’- item))
Then ‘mapply’ does the same thing, but with ‘apply’ instead.
(loop for item in ’((1 2 3) (4 5 6))
collect (apply #’+ item))
=> (6 15)
(mapply #’+ ’((1 2 3) (4 5 6)))
=> (6 15)
In variadic use, ‘mapply’ acts as if ‘append’ had first been used:
(mapply #’+ xs ys)
≡ (mapply #’+ (mapcar #’append xs ys))
But the actual implementation is more efficient.
‘mapply’ can convert a list of two-element lists into an alist:
(mapply #’cons ’((x 1) (y 2))
=> ’((x . 1) (y . 2))
When RESTART is active, invoke it with VALUES.
Like (member ITEM LIST :test #’eq). Should only be used for symbols.
Merge TABLES, working from left to right.
The resulting hash table has the same parameters as the first table.
If no tables are given, an new, empty hash table is returned.
If a single table is given, a copy of it is returned.
If the same key is present in two tables, the value from the rightmost
table is used.
All of the tables being merged must have the same value for
‘hash-table-test’.
Clojure’s ‘merge’.
Like ‘constantly’, but returns all of VALUES as multiple values. If there are not VALUES, returns nothing.
Like ‘reduce’ extended to multiple values.
Calling ‘mvfold’ with one seed is equivalent to ‘reduce’:
(mvfold fn xs seed) ≡ (reduce fn xs :initial-value seed)
However, you can also call ‘mvfold’ with multiple seeds:
(mvfold fn xs seed1 seed2 seed3 ...)
How is this useful? Consider extracting the minimum of a sequence:
(reduce #’min xs)
Or the maximum:
(reduce #’max xs)
But both?
(reduce (lambda (cons item)
(cons (min (car cons) item)
(max (cdr cons) item)))
xs
:initial-value (cons (elt xs 0) (elt xs 0)))
You can do this naturally with ‘mvfold’.
(mvfold (lambda (min max item)
(values (min item min)
(max item max)))
xs (elt xs 0) (elt xs 0))
In general ‘mvfold’ provides a functional idiom for “loops with
book-keeping” where we might otherwise have to use recursion or
explicit iteration.
Has a compiler macro that generates efficient code when the number of SEEDS is fixed at compile time (as it usually is).
Like ‘(reduce FN SEQ :from-end t)’ extended to multiple values. Cf. ‘mvfold’.
Like ‘append1’, but destructive.
Another alias for ‘not’ and ‘null’.
From Arc.
Removes a part of SEQUENCE between START and END and replaces it with
contents of NEW (if provided). SEQUENCE and NEW may be destroyed in the process
and the result is allowed to share structure with the original if SEQUENCE is a
list.
(nsplice-seq (list 1 2 3 4 5) :new (list :a :b :c) :start 1 :end 1)
=> (1 :A :B :C 2 3 4 5)
(nsplice-seq (list 1 2 3 4 5) :new (list :a :b :c) :start 1 :end 4)
=> (1 :A :B :C 5)
Omitting NEW removes elements from SEQUENCE:
(nsplice-seq (list 1 2 3 4 5) :start 1 :end 3)
=> ’(1 4 5)
Destructive version of ‘string-invert-case’.
Destructive version of ‘string-upcase-initials’.
Return a subsequence that may share structure with SEQ.
Note that ‘nsubseq’ gets its aposematic leading ‘n’ not because it is
itself destructive, but because, unlike ‘subseq’, destructive
operations on the subsequence returned may mutate the original.
‘nsubseq’ also works with ‘setf’, with the same behavior as ‘replace’.
Destructively set SEQ between START and END to VALUE. Uses ‘replace’ internally.
Return a function that returns only its NTH argument, ignoring all others.
If you’ve ever caught yourself trying to do something like
(mapcar #’second xs ys)
then ‘nth-arg’ is what you need.
If ‘hash-table-keys’ were not already defined by Alexandria, you could
define it as:
(defun hash-table-keys (table)
(maphash-return (nth-arg 0) table))
Return the Nth-best element of SEQ under PRED.
Equivalent to
(elt (sort (copy-seq seq) pred) n)
Or even
(elt (bestn (1+ n) seq pred) n)
But uses a selection algorithm for better performance than either.
Destructive version of ‘nth-best’.
Note that this function requires that SEQ be a vector.
Alias for ‘nthcdr’.
Remove duplicates from SEQ, starting from the end.
That means, for each duplicate, the first occurrence will be the kept, and subsequent occurrences will be discarded.
TEST defaults to ‘equal’.
From Haskell.
Return nil if arguments are equal under TEST, ARG1 otherwise.
Return a second value of nil if the arguments were equal, T
otherwise.
From SQL.
Return nil if XS is empty, XS otherwise.
If XS was empty the second value is nil; otherwise t.
This function also accepts multidimensional arrays. Arrays are
considered empty if their total size (from ‘array-total-size‘) is
zero.
Hash tables are considered empty if their count is 0.
If X is a nonzero number, return it, otherwise return nil. The second value is T if X was nonzero.
Is NODE present in TREE?
Is there a node (leaf or cons) in TREE that satisfies TEST?
Constructor an octet vector from ARGS.
Is X an octet vector?
Like ‘string=’ for octet vectors.
Return N, an integer, as an octet vector. Defaults to little-endian order.
Return a predicate that returns T when called on a sequence of
length LENGTH.
(funcall (of-length 3) ’(1 2 3)) => t
(funcall (of-length 1) ’(1 2 3)) => nil
Return a function that runs FN only once, caching the results forever.
Return the only element of SEQ.
If SEQ is empty, or contains more than one element, signal an error.
Given a sequence, return a function that, when called with ‘sort’,
restores the original order of the sequence.
That is, for any SEQ (without duplicates), it is always true that
(equal seq (sort (reshuffle seq) (ordering seq)))
FROM-END controls what to do in case of duplicates. If FROM-END is
true, the last occurrence of each item is preserved; otherwise, only
the first occurrence counts.
TEST controls identity; it should be a valid test for a hash table. If
the items cannot be compared that way, you can use KEY to transform
them.
UNORDERED-TO-END controls where to sort items that are not present in the original ordering. By default they are sorted first but, if UNORDERED-TO-END is true, they are sorted last. In either case, they are left in no particular order.
Return a list of the symbols exported by PACKAGE.
Return the name of PACKAGE as a keyword.
Return a list of all the names of PACKAGE: its name and its nicknames.
Pad VEC, a vector, to LENGTH, using PAD.
Like ‘pad-start’, but padding is addded to the end, rather than the
beginning.
Pad VEC, a vector, to LENGTH, using PAD.
If VEC is already the same length, or longer, than LENGTH, return VEC
unchanged.
(pad-start "abc" 3)
=> "abc"
If PAD is a sequence, then it is repeated before VEC to make up LENGTH.
(pad-start "abc" 9 "def")
=> "defdefabc"
If PAD is not a sequence, it is used to fill the remainder of VEC.
(pad-start "abc" 6 #x)
=> "xxxabc"
PAD defaults to the space character.
This function is most useful for strings, but it can be used with any
vector. Note that the vector returned has the same element type as
VEC, so PAD must satisfy that element type.
Loosely inspired by ECMA.
Like ‘pairlis’, but for a hash table.
Unlike ‘pairlis’, KEYS and DATA are only required to be sequences (of
the same length), not lists.
By default, the hash table returned uses ‘eql’ as its tests. If you want a different test, make the table yourself and pass it as the HASH-TABLE argument.
Parse STRING as a float of TYPE.
The type of the float is determined by, in order:
- TYPE, if it is supplied;
- The type specified in the exponent of the string;
- or ‘*read-default-float-format*’.
(parse-float "1.0") => 1.0s0
(parse-float "1.0d0") => 1.0d0
(parse-float "1.0s0" :type ’double-float) => 1.0d0
Of course you could just use ‘parse-number’, but sometimes only a float will do.
Given BODY, return two values: a list of the leading inline keyword
arguments, and the rest of the body.
Inline keywords are like the keyword arguments to individual cases in ‘restart-case’.
Partial application.
Unlike ‘alexandria:curry’, which is only inlined when you ask it to
be, ‘partial’ is always inlined if possible.
From Clojure.
Partition elements of SEQ into those for which PRED returns true
and false.
Return two values, one with each sequence.
Exactly equivalent to:
(values (remove-if-not predicate seq) (remove-if predicate seq))
except it visits each element only once.
Note that ‘partition‘ is not just ‘assort‘ with an up-or-down predicate. ‘assort‘ returns its groupings in the order they occur in the sequence; ‘partition‘ always returns the “true” elements first.
(assort ’(1 2 3) :key #’evenp) => ((1 3) (2))
(partition #’evenp ’(1 2 3)) => (2), (1 3)
Split DECLARATIONS into those that do and do not apply to XS.
Return two values, one with each set.
Both sets of declarations are returned in a form that can be spliced
directly into Lisp code:
(locally ,@(partition-declarations vars decls) ...)
Generalized version of PARTITION.
PREDS is a list of predicates. For each predicate, ‘partitions’
returns a filtered copy of SEQ. As a second value, it returns an extra
sequence of the items that do not match any predicate.
Items are assigned to the first predicate they match.
Return the basename, that is:
- if it’s a directory, the name of the directory,
- if it’s a file, the name of the file including its type (extension).
Build a pathname by merging from right to left.
With ‘path-join’ you can pass the elements of the pathname being built
in the order they appear in it:
(path-join (user-homedir-pathname) config-dir config-file)
≡ (uiop:merge-pathnames* config-file
(uiop:merge-pathnames* config-dir
(user-homedir-pathname)))
Note that ‘path-join’ does not coerce the parts of the pathname into
directories; you have to do that yourself.
(path-join "dir1" "dir2" "file") -> #p"file"
(path-join "dir1/" "dir2/" "file") -> #p"dir1/dir2/file"
Cf. ‘base-path-join’ for a similar function with more intuitive behavior.
Return the keys of a plist.
Return the values of a plist.
Lookup KEY in HASH-TABLE, return its value, and remove it.
This is only a shorthand. It is not in itself thread-safe.
From Zetalisp.
Return the powerset of SET. Uses a non-recursive algorithm.
Construct and return a list by concatenating LISTS in reverse order.
(prepend list-1 list-2)
≡ (append list-2 list-1)
Pretty print the hash-table HT to STREAM.
“‘
(pretty-print-hash-table (dict :a 1 :b 2 :c 3))
;; =>
(dict
:A 1
:B 2
:C 3
)
“‘
If you want to always pretty print hash tables, you can set this in your init file:
“‘ lisp
(toggle-pretty-print-hash-table)
“‘
Ported from RUTILS.
Return the product of all of the elements of ARRAY, a generalized array. Operates pairwise for numerical stability.
Is SUBTYPE a proper subtype of TYPE?
This is, is it true that SUBTYPE is a subtype of TYPE, but not the same type?
Is SUPERTYPE a proper supertype of TYPE?
That is, is it true that every value of TYPE is also of type SUPERTYPE, but not every value of SUPERTYPE is of type TYPE?
Remove LEAF from TREE wherever it occurs. See ‘prune-if’ for more information.
Remove any atoms satisfying TEST from TREE.
Pruning is defined "modulo flatten": you should get the same result
from pruning, and then flattening, that you would get from flattening,
and then filtering.
Also note that pruning is not defined for trees containing improper lists.
Append the elements of LIST onto the end of QUEUE. Return the queue.
Get the last element of a queue.
Destructively concatenate LIST onto the end of QUEUE. Return the queue.
The number of items in QUEUE.
A list of the items in QUEUE. Does not cons.
Destructively splice LIST at the beginning of QUEUE.
Insert ITEMS at the beginning of QUEUE.
Build a new queue with INITIAL-CONTENTS.
Is QUEUE empty?
Test for a queue.
Random number in the range [low,high).
LOW and HIGH are automatically swapped if HIGH is less than LOW.
Note that the value of LOW+HIGH may be greater than the range that can
be represented as a number in CL. E.g., you can generate a random double float with
(random-in-range most-negative-double-float most-positive-double-float)
even though (+ most-negative-double-float most-positive-double-float)
would cause a floating-point overflow.
From Zetalisp.
Return a (possibly specialized) vector of real numbers, starting from START.
With three arguments, return the integers in the interval [start,end)
whose difference from START is divisible by STEP.
START, STOP, and STEP can be any real number, except that if STOP is
greater than START, STEP must be positive, and if START is greater
than STOP, STEP must be negative.
The vector returned has the smallest element type that can represent
numbers in the given range. E.g. the range [0,256) will usually be
represented by a vector of octets, while the range [-10.0,10.0) will
be represented by a vector of single floats. The exact representation,
however, depends on your Lisp implementation.
STEP defaults to 1.
With two arguments, return all the steps in the interval [start,end).
With one argument, return all the steps in the interval [0,end).
Like (car (rassoc ...))
Like (cdr (rassoc ...))
Return the items of ARRAY as a sequence.
Array theory calls this operation ‘list’, but the MOA operation is identical and has a more distinctive name.
A helper for making objects readable.
The obvious way to give an object a readable representation is to use
the sharp-dot reader macro. However, methods are supposed to consult
the values of ‘*print-readably*’ and ‘*read-eval*’ before doing so.
This function takes care of that for you.
If ‘*print-readably*’ is false, return an empty string.
If ‘*print-readably*’ is true, and ‘*read-eval*’ is also true, return
the string "#.".
If ‘*print-readably*’ is true, but ‘*read-eval*’ is not true, signal an error.
Invokes the last bound RECKLESSLY-CONTINUE restart. Returns NIL if no such restart was bound or if the restart failed to transfer control.
Return a sequence like SEQ, with the same content, but repeated N times.
(repeat-sequence "13" 3)
=> "131313"
The length of the sequence returned will always be the length of SEQ
times N.
This means that 0 repetitions results in an empty sequence:
(repeat-sequence "13" 0)
=> ""
Conversely, N may be greater than the possible length of a sequence,
as long as SEQ is empty.
(repeat-sequence "" (1+ array-dimension-limit))
=> ""
Takes a single-argument FN and calls (fn x), then (fn (fn x)), and so on
until the result doesn’t change according to TEST. If MAX-DEPTH is specified
then FN will be called at most MAX-DEPTH times even if the result is still changing.
Returns two values, the stable result of FN and the remainder of
MAX-DEPTH. (If this value is 0, the result is unstable.)
Return an array that has the same items as ARRAY, a generalized
array, but whose shape is SHAPE.
If the resulting array is smaller than ARRAY, then discard the excess
items.
If the resulting array is larger than ARRAY, fill it with the items of
ARRAY cyclically.
ELEMENT-TYPE specifies an element type to use for the resulting array if one cannot be inferred from the array itself.
Like ‘alexandria:shuffle’, but non-destructive.
Regardless of the type of SEQ, the return value is always a vector.
If ELEMENT-TYPE is provided, this is the element type (modulo
upgrading) of the vector returned.
If ELEMENT-TYPE is not provided, then the element type of the vector returned is T, if SEQ is not a vector. If SEQ is a vector, then the element type of the vector returned is the same as the as the element type of SEQ.
Look for an executable using the PATH environment variable.
P is a pathname designator.
On Windows only, if P does not have an extension, it assumed to end in
‘.exe‘.
Note that this function does not check the current directory (even on Windows) and it does not care if P is already an absolute pathname: it only cares about its name and type.
If X and Y are the car and cdr of X-Y, return X-Y.
Otherwise, return a fresh cons of X and Y.
Like ‘round’, but return the resulting number.
(round 15 10) => 2
(round-to 15 10) => 20
Run all the hooks in HOOKS, without arguments.
The variable ‘*hook*’ is bound to the name of each hook as it is being
run.
Return a list of runs of similar elements in SEQ.
The arguments START, END, and KEY are as for ‘reduce’.
(runs ’(head tail head head tail))
=> ’((head) (tail) (head head) (tail))
By defualt, the function TEST is called with the first element of the
run as its first argument.
(runs #(10 1 5 10 1) :test #’>)
=> (#(10 1 5) #(10))
COMPARE-LAST changes this behavior to test against the previous
element of the run:
(runs #(10 1 5 10 1) :test #’> :compare-last t)
(#(10 1) #(5) #(10))
The COUNT argument limits how many runs are returned.
(runs ’(head tail tail head head tail) :count 2)
=> ’((head) (tail tail))
Return true if KEY-FN returns the same value for any/all members of LIST.
Every character with case in STRING has the same case. Return ‘:upper’ or ‘:lower’ as appropriate.
Return the partial reductions of SEQ.
Each element of the result sequence is the result of calling ‘reduce’
on the elements of the sequence up to that point (inclusively).
(reduce #’+ ’(1)) => 1
(reduce #’+ ’(1 2)) => 3
(reduce #’+ ’(1 2 3)) => 6
(reduce #’+ ’(1 2 3 4)) => 10
(scan #’+ ’(1 2 3 4)) => ’(1 3 6 10)
The result of calling ‘scan‘ on an empty sequence is always an empty
sequence, however.
(reduce #’+ ’()) => 0
(scan #’+ ’()) => ’()
This is sometimes called a "prefix sum", "cumulative sum", or
"inclusive scan".
From APL.
Like ‘equal’, but recursively compare sequences element-by-element.
Two elements X and Y are ‘seq=’ if they are ‘equal’, or if they are both sequences of the same length and their elements are all ‘seq=’.
Is X a sequence?
Return SET, a list considered as a set, as a hash table.
This is the equivalent of Alexandria’s ‘alist-hash-table’ and
‘plist-hash-table’ for a list that denotes a set.
STRICT determines whether to check that the list actually is a set.
The resulting hash table has the elements of SET for both its keys and
values. That is, each element of SET is stored as if by
(setf (gethash (key element) table) element)
Return the shape of ARRAY, a generalized array.
For a true array this is equivalent to ‘array-dimensions’.
Return the shorter of X and Y.
Return the shortest seq in SEQS.
If there are lists in SEQS, then the total number of conses traversed will never exceed n*m, where n is the number of lists in SEQS and m is the length of the shortest list.
Decrease N by a factor.
Given a number, return the prefix of the nearest SI unit.
Three values are returned: the long form, the short form, and the
multiplying factor.
(si-prefix 1001) => "kilo", "k", 1000d0
BASE can be 1000, 10, 1024, or 2. 1000 is the default, and prefixes start at kilo and milli. Base 10 is mostly the same, except the prefixes centi, deci, deca and hecto are also used. Base 1024 uses the same prefixes as 1000, but with 1024 as the base, as in vulgar file sizes. Base 2 uses the IEC binary prefixes.
Is SEQ a sequence of one element?
Like ‘subseq’, but allows negative bounds to specify offsets.
Both START and END accept negative bounds.
(slice "string" -3 -1) => "in"
A call to ‘slice’ where the first argument is positive and the second argument is negative is equivalent to chaining two calls to ‘drop’:
(drop 3 (drop -1 "string")) = "in"
(slice "string" 3 -1) = "in"
If the bounds cross in the middle, the result is an empty string:
(slice "x" 1 -1) => ""
Note that ‘slice’ implicitly clamps bounds, even when they are not negative:
(slice "x" 0 100) => "x"
Setf of ‘slice’ is like setf of ‘ldb’: afterwards, the place being set
holds a new sequence which is not EQ to the old.
Like ‘slot-value’, but doesn’t signal errors.
Returns three values:
1. The slot’s value (or nil),
2. A boolean that is T if the slot exists and *was* bound,
3. A boolean that is T if the slot exists.
Note that this function does call ‘slot-value’ (if the slot exists), so if there is a method on ‘slot-unbound’ for the class it will be invoked. In this case the second value will still be ‘nil’, however.
Return a sorted vector of the elements of SEQ.
You can think of this as a non-destructive version of ‘sort’, except
that it always returns a vector. (If you’re going to copy a sequence
for the express purpose of sorting it, you might as well copy it into
a form that can be sorted efficiently.)
ELEMENT-TYPE is interpreted as for ‘reshuffle’.
Removes a part of SEQUENCE between START and END and replaces it with
contents of NEW (if provided). Does not modify SEQUENCE or NEW, but the result
is allowed to share structure with the original if SEQUENCE is a list.
(splice-seq ’(1 2 3 4 5) :new ’(:a :b :c) :start 1 :end 1)
=> (1 :A :B :C 2 3 4 5)
(splice-seq ’(1 2 3 4 5) :new ’(:a :b :c) :start 1 :end 4)
=> (1 :A :B :C 5)
Omitting NEW removes elements from SEQUENCE:
(splice-seq ’(1 2 3 4 5) :start 1 :end 3)
=> ’(1 4 5)
Like ‘set-difference’, but preserve the order of LIST1’s elements.
Like ‘sort-new’, but sort as if by ‘stable-sort’ instead of ‘sort’.
Is SUFFIX a suffix of STRING?
Is SUBSTRING a substring of STRING?
This is similar, but not identical, to SEARCH.
(search nil "foo") => 0
(search "nil" "nil") => 0
(string*= nil "foo") => NIL
(string*= nil "nil") => T
Optimized function for building small strings.
Roughly equivalent to
(let ((*print-pretty* nil))
(format nil "~@{~a}" args...))
But may be more efficient when the arguments of certain simple types (such as strings, characters, symbols, pathnames, and fixnums).
Note that unlike ‘princ’, ‘string+’ treats ‘nil’ as the same as the
empty string:
(string+ nil)
=> ""
(string+ "x" nil)
=> "x"
This utility is inspired by the utility of the same name in Allegro.
Like ‘string*=’, but case-insensitive.
Count how many times SUBSTRING appears in STRING.
Equivalent to (gensym (string x)).
Generally preferable to calling GENSYM with a string, because it
respects the current read table.
The alternative to writing ‘(mapcar (compose #’gensym #’string) ...)’ in every other macro.
Invert the case of STRING.
This does the same thing as a case-inverting readtable:
- If the string is uppercase, downcase the string.
- If the string is lowercase, upcase the string.
- If the string is mixed-case, leave it alone.
Join strings in STRINGS, separated by SEPARATOR.
SEPARATOR can be any string designator.
If STREAM is provided, write to STREAM rather than returning a string.
If END is provided, then insert SEPARATOR after the last string, as
well as between strings.
Equivalent to ‘(mapconcat #’string STRINGS SEPARATOR)’.
Like ‘string^=’, but case-insensitive.
Like ‘string-replace-all’, but only replace the first match.
Do search-and-replace for constant strings.
Note that START and END only affect where the replacements are made:
the part of the string before START, and the part after END, are
always included verbatim.
(string-replace-all "old" "The old old way" "new"
:start 3 :end 6)
=> "The new old way"
COUNT can be used to limit the maximum number of occurrences to
replace. If COUNT is not specified, every occurrence of OLD between
START and END is replaced with NEW.
(string-replace-all "foo" "foo foo foo" "quux")
=> "quux quux quux"
(string-replace-all "foo" "foo foo foo" "quux" :count 2)
=> "quux quux foo"
STREAM can be used to specify a stream to write to. It is resolved like the first argument to ‘format’.
Like ‘string$=’, but case-insensitive.
Like ‘string~=’, but case-insensitive.
Return STRING with the first letter of each word capitalized.
This differs from STRING-CAPITALIZE in that the other characters in
each word are not changed.
(string-capitalize "an ACRONYM") -> "An Acronym")
(string-upcase-initials "an ACRONYM") -> "An ACRONYM")
From Emacs Lisp (where it is simply ‘upcase-initials’).
Is PREFIX a prefix of STRING?
Does TOKEN occur in STRING as a token?
Equivalent to
(find TOKEN (tokens STRING) :test #’string=),
but without consing.
Return the sum of all of the elements of ARRAY, a generalized array. Operates pairwise for numerical stability.
Is SUPERTYPE a supertype of TYPE? That is, is TYPE a subtype of SUPERTYPE?
Set KEY and VALUE in HASH-TABLE, returning the old values of KEY.
This is only a shorthand. It is not in itself thread-safe.
From Zetalisp.
Return, at most, the first N elements of SEQ, as a *new* sequence
of the same type as SEQ.
If N is longer than SEQ, SEQ is simply copied.
If N is negative, then |N| elements are taken (in their original order) from the end of SEQ.
Like ‘take-while’ with the complement of PRED.
Return the prefix of SEQ for which PRED returns true.
Return the total size of ARRAY, a generalized array. For a true array this is equivalent to ‘array-total-size’.
Wrap FN so it can be called no more than every WAIT seconds.
If FN was called less than WAIT seconds ago, return the values from the
last call. Otherwise, call FN normally and update the cached values.
WAIT, of course, may be a fractional number of seconds.
The throttled function is not thread-safe by default; use SYNCHRONIZED
to get a version with a lock.
You can pass MEMOIZED if you want the function to remember values between calls.
Toggles printing hash-tables with PRETTY-PRINT-HASH-TABLE or with the default method. If ON is set explicitly, turn on literal printing (T), otherwise use the default (NIL).
Ported from RUTILS.
Separate STRING into tokens.
Tokens are runs of non-whitespace characters.
(tokens "\"I’m here,\" Tom said presently.") => ("\"I’m" "here,\"" "Tom" "said" "presently.")
Cf. ‘words’.
Turn CONSTRAINTS into a predicate for use with SORT.
Each constraint should be two-element list, where the first element of
the list should come before the second element of the list.
(def dem-bones ’((toe foot)
(foot heel)
(heel ankle)
(ankle shin)
(shin knee)
(knee back)
(back shoulder)
(shoulder neck)
(neck head)))
(sort (reshuffle (mapcar #’car dem-bones))
(toposort dem-bones))
=> (TOE FOOT HEEL ANKLE SHIN KNEE BACK SHOULDER NECK)
If the graph is inconsistent, signals an error of type
‘inconsistent-graph‘:
(toposort ’((chicken egg) (egg chicken)))
=> Inconsistent graph: ((CHICKEN EGG) (EGG CHICKEN))
TEST, FROM-END, and UNORDERED-TO-END are passed through to ‘ordering’.
Use the trampoline technique to simulate mutually recursive functions.
Call FN with supplied ARGS, if any.
If FN returns a functions, call that function with no arguments.
Repeat until the return value is not a function, and finally return
that non-function value.
Note that, to return a function as a final value, you must wrap it in
some data structure and unpack it.
Most likely to be useful for Lisp implementations that do not provide
tail call elimination.
From Clojure.
STRING without whitespace at ends.
Coerce X to a boolean.
That is, if X is null, return ‘nil’; otherwise return ‘t’.
Based on an idea by Eric Naggum.
Return a function that takes any number of arguments and calls FN
on them as a list.
Wraps a function that expects a single argument, a list, so it can be used variadically.
Turn a sequence of BITS into an integer. Defaults to little-endian.
The value in the box X.
Put VALUE in box X.
Add an item to the front of QUEUE.
For an empty queue, this does the same thing as ENQ.
For a queue with elements, this adds a new element onto the front of
queue (like pushing to an ordinary list).
This is called ‘undeq’ because it can be used to undo a ‘deq’.
Recursively get the fundamental array that ARRAY is displaced to.
Return the fundamental array, and the start and end positions into it.
Borrowed from Erik Naggum.
Alias for ‘string-gensym’.
Convert a universal time to a Unix time.
Convert a Unix time to a universal time.
Concatenate BYTES, an octet vector, into an integer. Defaults to little-endian order.
Put together an ordinary lambda list from its constituent parts.
This is the inverse of ‘alexandria:parse-ordinary-lambda-list’.
lambda-list
≡ (multiple-value-call #’unparse-ordinary-lambda-list
(parse-ordinary-lambda-list lambda-list)
If FORM is non-nil, wrap it in a list.
This is useful with ,@ in macros, and with ‘mapcan’.
E.g., instead of writing:
‘(.... ,@(when flag ’((code))))
You can write:
‘(.... ,@(unsplice (when flag ’(code))))
It may be especially helpful when splicing in variables. Instead of
writing:
‘(.... ,@(and docstring ‘(,docstring)))
You can simply write:
‘(.... ,@(unsplice docstring))
From Lparallel.
Return the number of dimensions of ARRAY, a generalized array. For a true array this is equivalent to ‘array-rank’.
Return the elements of VEC, a vector, as multiple values. This is to vectors what ‘values-list’ is to lists.
Return a function that takes a single argument, a list, and
applies FN to it.
Practically equivalent to ‘(curry #’apply FN arguments...)’.
Succinct constructor for adjustable vectors with fill pointers.
(vect 1 2 3)
≡ (make-array 3
:adjustable t
:fill-pointer 3
:initial-contents (list 1 2 3))
The fill pointer is placed after the last element in INITIAL-CONTENTS.
As a constructor this also has a matching definition as a Trivia pattern for destructing.
Add NEW-ELEMENTS to the end of VECTOR, an adjustable array with a fill-pointer.
This is the practical equivalent to calling ‘vector-push-extend’ on
each element on NEW-ELEMENTS, but should be faster.
Returns VECTOR.
Like ‘string=’ for any vector.
If no TEST is supplied, elements are tested with ‘eql’.
Call FUN in turn over each atom and cons of TREE.
FUN can skip the current subtree with (throw TAG nil).
Is CHAR whitespace?
Spaces, tabs, any kind of line break, page breaks, and no-break spaces are considered whitespace.
Return a word-wrapped version of STRING that breaks at COLUMN.
Note that this is not a general-purpose word-wrapping routine like you would find in a text editor: in particular, any existing whitespace is removed.
Split STRING into words.
The definition of a word is the same as that used by ‘string-capitalize’: a run of alphanumeric characters.
(words "Four score and seven years")
=> ("Four" "score" "and" "seven" "years")
(words "2 words")
=> ("2" "words")
(words "two_words")
=> ("two" "words")
(words "\"I’m here,\" Tom said presently.")
=> ("I" "m" "here" "Tom" "said" "presently")
Cf. ‘tokens’.
Write the contents of FILE into STREAM.
Read STREAM and write the contents into PATHNAME.
STREAM will be closed afterwards, so wrap it with ‘make-concatenated-stream’ if you want it left open.
Add FN to the value of HOOK.
hook-any
) (handler handler-any
) &key append) ¶Add HANDLER to HOOK. Return HOOK. HOOK must be of type HOOK-ANY HANDLER must be of type HANDLER-ANY.
hook-number->number
) (handler handler-number->number
) &key append) ¶Add HANDLER to HOOK. Return HOOK.
HOOK must be of type HOOK-NUMBER->NUMBER
HANDLER must be of type HANDLER-NUMBER->NUMBER.
hook-string->string
) (handler handler-string->string
) &key append) ¶Add HANDLER to HOOK. Return HOOK.
HOOK must be of type HOOK-STRING->STRING
HANDLER must be of type HANDLER-STRING->STRING.
hook-void
) (handler handler-void
) &key append) ¶Add HANDLER to HOOK. Return HOOK. HOOK must be of type HOOK-VOID HANDLER must be of type HANDLER-VOID.
symbol
) fn &key append) ¶hook
) &rest args) ¶Return the list of values until the first nil result.
Handlers after the failing one are not run.
You need to check if the hook has handlers to know if a NIL return value is due
to the first handler failing or an empty hook.
This is an acceptable ‘combination’ for ‘hook’.
hook
) &rest args) ¶Return the value of the first non-nil result.
Handlers after the successful one are not run.
You need to check if the hook has handlers to know if a NIL return value is due
to all handlers failing or an empty hook.
This is an acceptable ‘combination’ for ‘hook’.
The constraints of an ‘inconsistent-graph’ error. Cf. ‘toposort’.
inconsistent-graph
)) ¶Return a unique lock associated with OBJECT.
synchronized
)) ¶automatically generated reader method
mutex
)) ¶Remove FN from the symbol value of HOOK.
Apply each function in HOOK to ARGS.
Like ‘run-hook-with-args’, but quit once a function returns nil.
symbol
) &rest args) ¶Like ‘run-hook-with-args’, but quit once a function returns non-nil.
symbol
) &rest args) ¶static-binding-flush-error
)) ¶static-binding-flush-error
)) ¶handler
)) ¶handler
)) ¶If the handler is meant to be a setter, VALUE can be used to describe what FN is
going to set to PLACE.
In particular, PLACE and VALUE can be used to compare handlers.
This can be left empty if the handler is not a setter.
topmost-object-class
) &rest initargs &key direct-superclasses topmost-class) ¶%read-only-struct
) &optional env) ¶topmost-object-class
) stream) ¶topmost-object-class
) &rest initargs &key direct-superclasses) ¶topmost-object-class
) (class2 standard-class
)) ¶sb-mop
.
A subtype of type-error specifically for case failures.
type-error
.
type-error
.
Initarg | Value |
---|---|
:matched-types | nil |
:matched-types
This slot is read-only.
An ECOND failed.
error
.
Initarg | Value |
---|---|
:test-count | 0 |
:test-count
A graph that cannot be consistently sorted.
error
.
The offending constraints
:constraints
This slot is read-only.
Violation of the letrec restriction.
The "letrec restriction" means that the expressions being bound in a
‘letrec’ cannot refer to the value of other bindings in the same
‘letrec’.
For ‘fbindrec’, the restriction applies everywhere. For ‘fbindrec*’, it only applies to functions not yet bound.
error
.
:args
error
.
:form
A subtype of error related to attempts to flush static bindings which are currently active.
program-error
.
static-binding-flush-error
.
Initarg | Value |
---|---|
:group | (required-argument group) |
A subtype of error related to attempts to flush static bindings in a potentially unsafe way.
error
.
Initarg | Value |
---|---|
:all-groups-p | nil |
:group | nil |
:group
This slot is read-only.
:all-groups-p
This slot is read-only.
A box is just a mutable cell.
You create a box using ‘box’ and get and set its value using the
accessor ‘unbox’.
(def a-box (box t))
(unbox a-box) => t
(setf (unbox a-box) nil)
(unbox a-box) => nil
Serapeum attempts to provide the guarantee that, on Lisps that support
atomic operations (compare-and-swap), ‘unbox‘ on boxes should be
updateable atomically. (See
[atomics](https://github.com/Shinmera/atomics)).
At the moment, boxes are implemented as structures, but that may change. In particular, you should not depend on being able to recognize boxes using a type or predicate.
structure-object
.
Basic cons queues, with an implementation based on PAIP and the original Norvig & Waters paper, and an API mostly borrowed from Arc.
About Arc. For the most part, Arc-style identifiers are pessimal,
neither quite opaque nor quite explicit, like riddles. But by using
abbreviated names, we avoid the danger of clashing with
special-purpose queue implementations.
Create a queue with ‘queue’, like ‘list’:
(queue 1 2 3) => #<QUEUE (1 2 3)>
Get the items with ‘qlist’:
(qlist (queue 1 2 3)) => ’(1 2 3)
Add items with ‘enq’:
(enq 3 (queue 1 2)) => #<QUEUE (1 2 3)>
Remove an item with ‘deq’:
(deq (queue 1 2 3)) => 1
Prepend an item with ‘undeq’:
(qlist (undeq 1 (queue 2 3))) => ’(1 2 3)
To (destructively) join a list to the end of the queue, use ‘qconc’:
(qconc (queue 1 2 3) ’(4 5 6)) => #<QUEUE (1 2 3 4 5 6)>
The rest of the API:
- ‘queuep’ Test for a queue
- ‘qlen’ Like ‘(length (qlist ...))’
- ‘clear-queue’ Clear the queue
- ‘front’ Like ‘(car (qlist ...))’
- ‘qback’ Get the last element of the queue
- ‘queue-empty-p’ Test if the queue is empty
- ‘qappend’ Non-destructively join a list to the end of the queue
- ‘qconc’ Destructively join a list to the end of the queue
- ‘qprepend’ Non-destructively join a list to the front of the queue
Note that support for both ‘deq’ and ‘undeq’ means that a queue is
also effectively a stack. (But not quite a double-ended queue: you can
push to either end, and pop from the front, but you can’t pop from the
end.)
The idea is that *collecting* is something we do often enough to justifying making *collectors* (queues) first-class.
structure-object
.
common-lisp
.
cons
(error "no cons!")
This slot is read-only.
Handlers are wrappers around functions used in typed hooks.
They serve two purposes as opposed to regular functions:
- They can embed a NAME so that anonymous functions can be conveniently used in lambda.
- If the handler is meant to be a setter, the PLACE and VALUE slot can be used to identify and compare setters.
With this extra information, it’s possible to compare handlers and, in particular, avoid duplicates in hooks.
Name of the handler.
If defaults to the function name if ‘fn’ is a named function.
This is useful so that the user can build handlers out of anonymous functions.
symbol
:name
name
.
Description of the handler. This is purely informative.
string
""
:description
The handler function. It can be an anonymous function.
The function type of FN. This is purely informative.
:handler-type
If the handler is meant to be a setter, PLACE describes what is set.
PLACE can be a symbol or a pair (CLASS SLOT).
This can be left empty if the handler is not a setter.
(or symbol list)
:place
If the handler is meant to be a setter, VALUE can be used to describe what FN is
going to set to PLACE.
In particular, PLACE and VALUE can be used to compare handlers.
This can be left empty if the handler is not a setter.
:value
This hook class serves as support for typed-hook.
Typing in hook is crucial to guarantee that a hook is well formed, i.e. that it’s handlers accept the right argument types and return the right value types.
Because typing is too limited in Common Lisp, we leverage CLOS to generate
subclasses of ‘hook’ and ‘handlers’ with typed helper functions.
The ‘add-hook’ will thus only accept handlers of the right types.
This implementation is good enough to catch typing errors at compile time.
(setf combination)
.
combination
.
combine-composed-hook
.
combine-hook-until-failure
.
combine-hook-until-success
.
default-combine-hook
.
disable-hook
.
(setf disabled-handlers)
.
disabled-handlers
.
enable-hook
.
handler-class
.
(setf handlers)
.
handlers
.
remove-hook
.
run-hook
.
run-hook-with-args-until-failure
.
run-hook-with-args-until-success
.
The class of the supported handlers.
symbol
t
This slot is read-only.
list
(quote nil)
:handlers
Those handlers are not run by ‘run-hook’.
This is useful it the user wishes to disable some or all handlers without
removing them from the hook.
list
(quote nil)
:disabled-handlers
This can be used to reverse the execution order, return a single value, etc.
function
(function serapeum/contrib/hooks:default-combine-hook)
:combination
Mixin for a class with its own monitor.
standard-class
.
symbol
:topmost-class
This slot is read-only.
The type of a function from ARGS to VALUES.
The type of the error signaled by ‘no-applicable-method’ on this Lisp. Note this may not be unique.
A pathname without wild components.
An array of octets.
A soft constraint for the elements of an alist.
Equivalent to ‘(soft-list-of (cons KEY-TYPE VALUE-TYPE))‘.
A soft constraint for the elements of a list.
The elements are restricted only as far as is practical, which is not very far, using heuristics which will not be specified here because they may improve over time. That said, since the goal of this type is to be practically useful, it will avoid any checks that would be O(n) in the length of the list.
Return a disjunction of all the direct subtypes of CLASS.
This can be useful for exhaustiveness checking over the direct
subtypes of a class.
This should not be used for classes meant to be subclassed by library users.
A proper list where each element has the same type as the corresponding element in TYPES.
(typep ’(1 :x #c) ’(tuple integer keyword character)) => T
As a shortcut, a quoted form among TYPES is expanded to an ‘eql’ type specifier.
(tuple ’function symbol)
≡ (tuple (eql function) symbol)
Literal keywords, numbers, and characters are also treated as ‘eql’ type specifiers.
(tuple :name 1 #a symbol)
≡ (tuple (eql :name) (eql 1) (eql #a) symbol)
A whole number. Equivalent to ‘(integer 0 *)’.
A pathname with wild components.
Path separator for this OS.
The IEC binary prefixes, as powers of 2.
Max length above which to operate pairwise.
List as SI prefixes: power of ten, long form, short form.
The SI prefixes as powers of 1000, with centi, deci, deca and hecto omitted.
Reader control variables bound by ‘with-standard-io-syntax’.
Whitespace characters.
Global hook table.
Implementation-appropriate target syntax clause deduplication.
How should repeated clauses in a case macro be deduplicated? With flet
or a tagbody?
Symbols that should not occur in the head of a list of forms. E.g. ‘progn’, ‘locally’.
The environment of the macro being expanded.
Only for Lisps that do not support extensible sequences.
Intern COLLECT in the current package and bind it as a collector with MACROLET.
Declare that FNs are constant functions, for the benefit of Lisps that understand such declarations.
Declare that TYPES is not going to change.
On Lisps that understand it, this is roughly equivalent to "sealing" a type in an OOP language: a promise that the type will never have any new subtypes, so tests for the type can be open-coded.
The simple, out-of-line version.
Iterate over the items of a vector in a manner similar to ‘dolist’.
Like ‘etypecase-of’, but filter shadowed clauses.
Like LET, but if any of BINDINGS are uninitialized, try to give them sane initialization values.
Bind VAR, immutably, to EXPR and evaluate BODY.
This may be pronounced with equal propriety as "let-one" or "let-once".
Like ‘rebinding’, but specifically for functions.
The value being rebound will be wrapped in ‘ensure-function’.
Efficiently dispatch on the type of SEQ.
Efficiently dispatch on the type of VEC.
The first form provides special handling for bit vectors. The second
form provides generic handling for all types of vectors.
Like ‘with-gensyms’, but binds SYMS in the current package.
Wrap BODY with inlined bucket accessors for lists.
Wrap BODY with inlined bucket accessors for generic sequences.
This might not seem worthwhile, and it’s not for ‘bucket-seq’, but for ‘bucket-push’ (and even ‘make-bucket’) it is, since accumulating for generic sequences just uses queues.
If VECTOR is a displaced or adjustable array, binds V to the
underlying simple vector, adds an adequate offset to START and
END and binds those offset values to S and E. Otherwise, if
VECTOR is already a simple array, it’s simply bound to V with no
further changes.
START and END are unchecked and assumed to be within bounds.
Note that in some Lisps, a slow copying implementation is necessary to obtain a simple vector thus V will be bound to a copy of VECTOR coerced to a simple-vector. Therefore, you shouldn’t attempt to modify V.
Ensure BODY is run with the appropriate specialized, inlined
versions of the bucket accessors.
This is only likely to be worthwhile around a loop; if you’re calling a bucket accessor once or twice the code bloat isn’t worth it.
Wrap BODY with inlined bucket accessors for strings.
Wrap BODY with inlined bucket accessors for vectors (including strings).
Split the PATH environment variable.
Add HANDLER to HOOK if not already in it.
Return HOOK.
HANDLER is also not added if in the ‘disabled-handlers’.
If APPEND is non-nil, HANDLER is added at the end.
Pull apart BINDINGS, looking for lambdas to lift.
Append ITEMS to the end of BUCKET according to SEQ.
The items will appear, together and in the same order, in the sequence taken from the bucket by BUCKET-SEQ.
Insert ITEM at the end of BUCKET according to SEQ.
Return a sequence "like" SEQ using the elements of BUCKET.
Note that it is not safe to call the function more than once on the same bucket.
Return a form, suitable for the bindings of a ‘flet’ or ‘labels’
form, that binds a function named FN which calls the function in a
variable named VAR.
If there is a declared ftype for FN in the decls-env combination, it may be used to make calling VAR more efficient by avoiding ‘apply’.
Resolve STREAM like ‘format’ and call FN with the result.
Check that none of NAMES are declared ‘dynamic-extent’ in DECLARATIONS.
Check that HT1 and HT2, two hash tables, have the same value for
‘hash-table-test’.
This should work even for "custom" hash tables with user-defined tests.
Collect fallthrough clauses from MORE-BRANCHES into BRANCH.
Copy an instance of AGROUP, optionally overriding some or all of its slots.
Copy an instance of BOUNDS, optionally overriding some or all of its slots.
Make a hash table with the same parameters (test, size, &c.) as TABLE, but empty.
Copy an instance of SUBENV, optionally overriding some or all of its slots.
Return a vector of ascending positive integers.
With one argument, return all the integers in the interval [0,end).
With two arguments, return all the integers in the interval [start,end).
With three arguments, return the integers in the interval [start,end) whose difference from START is evenly divisible by STEP.
If DECLS contains an ftype declaration for FN, return it.
Returns three values. The first two values are the arguments type and
return type. The third is a boolean, which is ‘t’ only when there was
an ftype declaration.
The default tie breaker for a topological sort.
Like ‘delete’ but return (values NEW-SEQUENCE FOUNDP) with FOUNDP being T if the element was found, NIL otherwise.
Shorthand function for displacing an array.
Look for the superclass bound in ENV.
Helper function for ‘nest’.
Auxiliary function for ‘pad-X’ compiler macros. Optimizes some cases where PAD is a constant sequence.
Extract the individual types from a type defined as a disjunction. TYPE could be the actual disjunction, or the name of the type.
If TYPE is not a disjunction, just return TYPE as a list.
Note that ‘member’ types are disjunctions:
(explode-type (member :x :y :z) nil)
=> ((eql :x) (:eql y) (eql :z))
If possible, extract the name from X, a function designator.
Compare two files by looping over their contents using a buffer.
Helper for FILTER.
Perform floating-point contagion on START, STOP, and STEP, and call ‘range’ on the results.
Is X a gensym’d (uninterned) symbol?
Hoist the bodies of the clauses into tags.
This is needed because the same clause may be spliced into the
dispatch-case form in several places (in order to implement
fallthrough).
Returns two values: a list of alternating tags and forms, and a list of clauses rewritten to jump to the tags.
Given a list of bindings and a set of declarations, look for any uninitialized bindings. If there are any, try to extrapolate reasonable initialization values for them based on the declarations in DECLS.
Return the length and element type for a range vector from START to STOP by STEP.
Return a function of two arguments which uses KEY to extract the part of the arguments to compare, and compares them using TEST.
Return a list of the variables bound in LAMBDA-LIST, an ordinary lambda list.
Expand form, using ‘expand-macro’. If the result is a simple let-over-lambda, analyze it into an environment, declarations, and a lambda.
Return a list of all of the items in ARRAYS.
Traverse LIST from the end, calling FUN on each item.
This uses the technique described by Durand and Strandh in their paper presented at ECLS 2015, “Processing List Elements in Reverse Order.”
Find the longest list in LISTS.
Return a "bucket" suitable for collecting elements from SEQ.
If SEQ is restricted as to the type of elements it can hold (for example, if SEQ is an array with an element type) the same restriction will apply to the bucket.
Return a ‘handler’.
NAME is only mandatory if FN is a lambda.
CLASS-NAME can be used to create handler subclasses.
HANDLER-TYPE, PLACE and VALUE are as per the sltos in ‘handler-type’.
This function should not be used directly.
Prefer the typed make-handler-* functions instead.
Helper function: make a sequence of length LEN having the same type as SEQ.
Alias for ‘alexandria:make-gensym-list’.
Helper function to map SEQ between START and END.
Which functions in NAMES are merely syntactic?
Functions are "merely syntactic" if they are never dereferenced with
‘function’ (or sharp-quote).
This function may return false negatives – it may fail to detect that a function is syntactic – but it should never return a false positive – it should never say a function is syntactic when it is not.
Normalize CASES, clauses for a case-like macro.
Return each non-default clause normalized to ‘(keys . body)’, where
keys is a *list* of keys.
Return the default clause as a second value.
If there is more than one default clause, signal an error.
Parse the args to defmethod (everything except the name). Returns three values: a list of qualifiers, the specialized lambda-list, and the forms that make up the body.
Partition FBINDS using the "Fixing Letrec" algorithm.
Returns the bindings in four sets: unreferenced, literal lambdas,
simple (external references) and complex (everything else).
BODY is needed because we detect unreferenced bindings by looking for ‘ignore’ declarations.
Return two values: the type and the final pattern.
Query ENV for optimization declaration information. Returns 1 when the environment cannot be accessed.
Hoare’s quickselect, as implemented by Wirth ("FIND"), with refinements by V. Zabrodsky ("MODIFIND").
Read and evaluate a value.
Rewrite CLAUSE, an include clause, for use with a read-only structure.
Rewrite SLOT, a structure slot definition, to be read-only.
Note that if SLOT is of an odd length, then it is treated as being
without an initialization form, and a default initialization form that
raises an error is supplied.
Given a list of typecase clauses, remove any clauses that are shadowed by previous clauses.
Remove shadowed types in SUBTYPES.
Subtypes are shadowed when they are subtypes of the disjunction of all
preceding types.
Like ‘replace’ with no keyword arguments, but if IN is shorter than
OUT, extend it cyclically.
In the base case, if IN is empty, leave OUT alone.
Like ‘rotate’, but non-destructive.
A predicate that compares whether X and Y have the same literal representation.
Do two hash tables have the same test?
Like ‘alexandria:type=’, but takes an environment.
Helper to ‘set’ a slice non-destructively.
Return true if ARRAY1 and ARRAY2 have the same shape.
Find the shortest list in LISTS.
Make an array of shape SHAPE containing OBJECT as its initial element. The array will have the smallest element type sufficient to contain OBJECT.
A lambda list with no inits.
Simplify the keylists in CLAUSES.
If the keylist is an empty list, omit the clause.
If the keylist is a list with one element, unwrap that element.
Otherwise, leave the keylist alone.
Normalize START and END, which may be negative, to offsets acceptable to SUBSEQ.
Given a list of typecase clauses, order them so no preceding clause shadows later ones, if possible.
Sort SUBTYPES such that subtypes always precede supertypes.
Return T if ENV says we should prefer space to speed.
Does the disjunction of SUBTYPES exhaust TYPE? SUBTYPES must all be subtypes of TYPE.
Do the initial topological sort.
internal-definitions-env
) decls) ¶letrec-restriction-violation
)) ¶letrec-restriction-violation
)) ¶args
.
internal-definitions-env
)) ¶Return non-nil if this is the first form in the ‘local’.
null
) v1 v2) ¶internal-definitions-env
) offender) ¶vector
) (v2 vector
) test (bounds null
)) ¶vector
) (v2 vector
) (test test/equalp
) (bounds null
)) ¶simple-array-unsigned-byte-8
) (v2 simple-array-unsigned-byte-8
) (test test/rat=
) (bounds bounds
)) ¶simple-array-unsigned-byte-8
) (v2 simple-array-unsigned-byte-8
) (test test/rat=
) (bounds null
)) ¶vector
) (w vector-wrapper
) test bounds) ¶vector-wrapper
) (v vector
) test bounds) ¶vector-wrapper
) (w2 vector-wrapper
) test bounds) ¶rat-vector
) (w2 rat-vector
) (test test/rat=
) (bounds null
)) ¶numeric-vector
) (w2 numeric-vector
) (test test/=
) (bounds null
)) ¶string
) (s2 string
) (test test/char-equal
) (bounds bounds
)) ¶string
) (s2 string
) (test test/char=
) (bounds bounds
)) ¶string
) (s2 string
) (test test/char-equal
) (bounds null
)) ¶string
) (s2 string
) (test test/char=
) (bounds null
)) ¶dispatch-case-error
)) ¶internal-definitions-env
) name wrapper) ¶internal-definitions-env
) var) ¶internal-definitions-env
) body) ¶Shorthand for recursing on an implicit ‘progn’.
internal-definitions-env
) form &optional env) ¶internal-definitions-env
) form &optional env) ¶Like macroexpand-1, but handle local symbol macro bindings.
internal-definitions-env
) form) ¶Macro-expand FORM until it becomes a definition form or macro expansion stops.
internal-definitions-env
) forms) ¶internal-definitions-env
) form) ¶internal-definitions-env
) body) ¶internal-definitions-env
) var) ¶internal-definitions-env
)) ¶Are we within a binding form?
internal-definitions-env
) var) ¶append
.
:most-specific-first
internal-definitions-env
) name exp) ¶internal-definitions-env
) name) ¶internal-definitions-env
) spliced-forms) ¶internal-definitions-env
) form) ¶test/equal
)) ¶test/char=
)) ¶test/char-equal
)) ¶test/equalp
)) ¶function
)) ¶topmost-object-class
)) ¶automatically generated reader method
vector-wrapper
)) ¶automatically generated reader method
internal-definitions-env
)) ¶internal-definitions-env
) bindings) ¶internal-definitions-env
) form) ¶internal-definitions-env
) bindings) ¶Abstract base class for read-only structures.
structure-object
.
Abstract base class for unit classes.
Auxiliary data structure for ‘assort’. A pair of an exemplar (to compare against) and a bucket of matching items. Note that while the agroup is immutable, the bucket itself is mutable.
(alexandria:required-argument (quote serapeum::exemplar))
This slot is read-only.
(alexandria:required-argument (quote serapeum::bucket))
This slot is read-only.
alexandria:array-index
(alexandria:required-argument (quote serapeum/vector=::start1))
This slot is read-only.
alexandria:array-length
(alexandria:required-argument (quote serapeum/vector=::end1))
This slot is read-only.
alexandria:array-index
(alexandria:required-argument (quote serapeum/vector=::start2))
This slot is read-only.
alexandria:array-length
(alexandria:required-argument (quote serapeum/vector=::end2))
This slot is read-only.
Create an empty (max) heap.
SIZE is a hint for at least how many items will be used; it is not a
limit but providing it speeds up initializing the heap.
ELEMENT-TYPE is like the ‘:element-type’ argument to ‘make-array’. It
may, or may not, restrict the element type of the heap, depending on
the request type and what the Lisp implementation supports. It is for
optimization, not type safety.
KEY and TEST are used to order the heap elements.
structure-object
.
common-lisp
.
vector
#()
This slot is read-only.
function
(function identity)
function
(function >=)
Minimal lexical environment.
list
(alexandria:required-argument (quote serapeum/internal-definitions::vars))
This slot is read-only.
list
(alexandria:required-argument (quote serapeum/internal-definitions::funs))
This slot is read-only.
list
(alexandria:required-argument (quote serapeum/internal-definitions::blocks))
This slot is read-only.
list
(alexandria:required-argument (quote serapeum/internal-definitions::tags))
This slot is read-only.
Placeholder for an unbound variable.
symbol
(alexandria:required-argument (quote serapeum::var))
This slot is read-only.
alias-decls
.
at-beginning?
.
check-beginning
.
eject-macro
.
ensure-var-alias
.
expand-body
.
expand-in-env
.
expand-in-env-1
.
expand-partially
.
expand-top
.
expansion-done
.
generate-internal-definitions
.
hoisted-var?
.
in-subenv?
.
known-var?
.
save-symbol-macro
.
shadow-symbol-macro
.
splice-forms
.
step-expansion
.
var-alias-bindings
.
wrap-bindings
.
wrap-expr
.
wrap-fn-bindings
.
Initarg | Value |
---|---|
:env | nil |
:decls | nil |
list
list
list
:decls
list
common-lisp
.
list
list
list
The Lisp environment.
:env
A (possibly negated) array index.
A (possibly negated) array length.
Jump to: | $
%
(
-
@
~
A B C D E F G H I J K L M N O P Q R S T U V W |
---|
Jump to: | $
%
(
-
@
~
A B C D E F G H I J K L M N O P Q R S T U V W |
---|
Jump to: | %
*
+
A B C D E F G H I K L M N O P R S T U V W |
---|
Jump to: | %
*
+
A B C D E F G H I K L M N O P R S T U V W |
---|
Jump to: | %
-
A B C D E F G H I K L M N O P Q R S T U V W |
---|
Jump to: | %
-
A B C D E F G H I K L M N O P Q R S T U V W |
---|