alexandria

API Reference

alexandria

Alexandria is a collection of portable public domain utilities.

ALEXANDRIA.0.DEV

  • Macro DEFINE-CONSTANT (name initial-value &key (test ''eql) documentation)
    Ensures that the global variable named by NAME is a constant with a value that is equal under TEST to the result of evaluating INITIAL-VALUE. TEST is a /function designator/ that defaults to EQL. If DOCUMENTATION is given, it becomes the documentation string of the constant. Signals an error if NAME is already a bound non-constant variable. Signals an error if NAME is already a constant variable whose value is not equal under TEST to result of evaluating INITIAL-VALUE.
  • Macro IF-LET (bindings &body (then-form &optional else-form))
    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 all variables were bound to true values, the THEN-FORM is executed with the bindings in effect, otherwise the ELSE-FORM is executed with the bindings in effect.
  • Macro WHEN-LET (bindings &body forms)
    Creates new variable bindings, and conditionally executes FORMS. 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 all variables were bound to true values, then FORMS are executed as an implicit PROGN.
  • Macro WHEN-LET* (bindings &body forms)
    Creates new variable bindings, and conditionally executes FORMS. 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)) Each initial-form is executed in turn, and the variable bound to the corresponding value. Initial-form expressions can refer to variables previously bound by the WHEN-LET*. Execution of WHEN-LET* stops immediately if any initial-form evaluates to NIL. If all initial-forms evaluate to true, then FORMS are executed as an implicit PROGN.
  • Type STRING-DESIGNATOR
    A string designator type. A string designator is either a string, a symbol, or a character.
  • Function REQUIRED-ARGUMENT (&optional name)
    Signals an error for a missing argument of NAME. Intended for use as an initialization form for structure and class-slots, and a default value for required keyword arguments.
  • Condition SIMPLE-STYLE-WARNING  (SIMPLE-WARNING, STYLE-WARNING)
  • Function SIMPLE-STYLE-WARNING (message &rest args)
  • Condition SIMPLE-READER-ERROR  (SIMPLE-READER-ERROR)
  • Function SIMPLE-READER-ERROR (stream message &rest args)
  • Condition SIMPLE-PARSE-ERROR  (SIMPLE-ERROR, PARSE-ERROR)
  • Function SIMPLE-PARSE-ERROR (message &rest args)
  • Condition SIMPLE-PROGRAM-ERROR  (SIMPLE-ERROR, PROGRAM-ERROR)
  • Function SIMPLE-PROGRAM-ERROR (message &rest args)
  • Macro IGNORE-SOME-CONDITIONS ((&rest conditions) &body body)
    Similar to CL:IGNORE-ERRORS but the (unevaluated) CONDITIONS list determines which specific conditions are to be ignored.
  • Macro UNWIND-PROTECT-CASE ((&optional abort-flag) protected-form &body clauses)
    Like CL:UNWIND-PROTECT, but you can specify the circumstances that the cleanup CLAUSES are run. clauses ::= (:NORMAL form*)* | (:ABORT form*)* | (:ALWAYS form*)* Clauses can be given in any order, and more than one clause can be given for each circumstance. The clauses whose denoted circumstance occured, are executed in the order the clauses appear. ABORT-FLAG is the name of a variable that will be bound to T in CLAUSES if the PROTECTED-FORM aborted preemptively, and to NIL otherwise. Examples: (unwind-protect-case () (protected-form) (:normal (format t "This is only evaluated if PROTECTED-FORM executed normally.~%")) (:abort (format t "This is only evaluated if PROTECTED-FORM aborted preemptively.~%")) (:always (format t "This is evaluated in either case.~%"))) (unwind-protect-case (aborted-p) (protected-form) (:always (perform-cleanup-if aborted-p)))
  • Macro WITH-INPUT-FROM-FILE ((stream-name file-name &rest args &key (direction nil direction-p) &allow-other-keys) &body body)
    Evaluate BODY with STREAM-NAME to an input stream on the file FILE-NAME. ARGS is sent as is to the call to OPEN except EXTERNAL-FORMAT, which is only sent to WITH-OPEN-FILE when it's not NIL.
  • Macro WITH-OUTPUT-TO-FILE ((stream-name file-name &rest args &key (direction nil direction-p) &allow-other-keys) &body body)
    Evaluate BODY with STREAM-NAME to an output stream on the file FILE-NAME. ARGS is sent as is to the call to OPEN except EXTERNAL-FORMAT, which is only sent to WITH-OPEN-FILE when it's not NIL.
  • Function READ-STREAM-CONTENT-INTO-STRING (stream &key (buffer-size 4096))
    Return the "content" of STREAM as a fresh string.
  • Function READ-FILE-INTO-STRING (pathname &key (buffer-size 4096) external-format)
    Return the contents of the file denoted by PATHNAME as a fresh string. The EXTERNAL-FORMAT parameter will be passed directly to WITH-OPEN-FILE unless it's NIL, which means the system default.
  • Function WRITE-STRING-INTO-FILE (string pathname &key (if-exists :error) if-does-not-exist external-format)
    Write STRING to PATHNAME. The EXTERNAL-FORMAT parameter will be passed directly to WITH-OPEN-FILE unless it's NIL, which means the system default.
  • Function READ-STREAM-CONTENT-INTO-BYTE-VECTOR (stream &key ((%length length)) (initial-size 4096))
    Return "content" of STREAM as freshly allocated (unsigned-byte 8) vector.
  • Function READ-FILE-INTO-BYTE-VECTOR (pathname)
    Read PATHNAME into a freshly allocated (unsigned-byte 8) vector.
  • Function WRITE-BYTE-VECTOR-INTO-FILE (bytes pathname &key (if-exists :error) if-does-not-exist)
    Write BYTES to PATHNAME.
  • Function COPY-FILE (from to &key (if-to-exists :supersede) (element-type '(unsigned-byte 8)) finish-output)
  • Function COPY-STREAM (input output &key (element-type (stream-element-type input)) (buffer-size 4096) (buffer (make-array buffer-size :element-type element-type)) (start 0) end finish-output)
    Reads data from INPUT and writes it to OUTPUT. Both INPUT and OUTPUT must be streams, they will be passed to READ-SEQUENCE and WRITE-SEQUENCE and must have compatible element-types.
  • Macro WITH-GENSYMS (names &body forms)
    Binds each variable named by a symbol in NAMES to a unique symbol around FORMS. Each of NAMES must either be either a symbol, or of the form: (symbol string-designator) Bare symbols appearing in NAMES are equivalent to: (symbol symbol) The string-designator is used as the argument to GENSYM when constructing the unique symbol the named variable will be bound to.
  • Macro WITH-UNIQUE-NAMES (names &body forms)
    Alias for WITH-GENSYMS.
  • Macro ONCE-ONLY (specs &body forms)
    Evaluates FORMS with symbols specified in SPECS rebound to temporary variables, ensuring that each initform is evaluated only once. Each of SPECS must either be a symbol naming the variable to be rebound, or of the form: (symbol initform) Bare symbols in SPECS are equivalent to (symbol symbol) Example: (defmacro cons1 (x) (once-only (x) `(cons ,x ,x))) (let ((y 0)) (cons1 (incf y))) => (1 . 1)
  • Function PARSE-BODY (body &key documentation whole)
    Parses BODY into (values remaining-forms declarations doc-string). Documentation strings are recognized only if DOCUMENTATION is true. Syntax errors in body are signalled and WHOLE is used in the signal arguments when given.
  • Function PARSE-ORDINARY-LAMBDA-LIST (lambda-list &key (normalize t) allow-specializers (normalize-optional normalize) (normalize-keyword normalize) (normalize-auxilary normalize))
    Parses an ordinary lambda-list, returning as multiple values: 1. Required parameters. 2. Optional parameter specifications, normalized into form: (name init suppliedp) 3. Name of the rest parameter, or NIL. 4. Keyword parameter specifications, normalized into form: ((keyword-name name) init suppliedp) 5. Boolean indicating &ALLOW-OTHER-KEYS presence. 6. &AUX parameter specifications, normalized into form (name init). 7. Existence of &KEY in the lambda-list. Signals a PROGRAM-ERROR is the lambda-list is malformed.
  • Macro DESTRUCTURING-CASE (keyform &body clauses)
    DESTRUCTURING-CASE, -CCASE, and -ECASE are a combination of CASE and DESTRUCTURING-BIND. KEYFORM must evaluate to a CONS. Clauses are of the form: ((CASE-KEYS . DESTRUCTURING-LAMBDA-LIST) FORM*) The clause whose CASE-KEYS matches CAR of KEY, as if by CASE, CCASE, or ECASE, is selected, and FORMs are then executed with CDR of KEY is destructured and bound by the DESTRUCTURING-LAMBDA-LIST. Example: (defun dcase (x) (destructuring-case x ((:foo a b) (format nil "foo: ~S, ~S" a b)) ((:bar &key a b) (format nil "bar, ~S, ~S" a b)) (((:alt1 :alt2) a) (format nil "alt: ~S" a)) ((t &rest rest) (format nil "unknown: ~S" rest)))) (dcase (list :foo 1 2)) ; => "foo: 1, 2" (dcase (list :bar :a 1 :b 2)) ; => "bar: 1, 2" (dcase (list :alt1 1)) ; => "alt: 1" (dcase (list :alt2 2)) ; => "alt: 2" (dcase (list :quux 1 2 3)) ; => "unknown: 1, 2, 3" (defun decase (x) (destructuring-case x ((:foo a b) (format nil "foo: ~S, ~S" a b)) ((:bar &key a b) (format nil "bar, ~S, ~S" a b)) (((:alt1 :alt2) a) (format nil "alt: ~S" a)))) (decase (list :foo 1 2)) ; => "foo: 1, 2" (decase (list :bar :a 1 :b 2)) ; => "bar: 1, 2" (decase (list :alt1 1)) ; => "alt: 1" (decase (list :alt2 2)) ; => "alt: 2" (decase (list :quux 1 2 3)) ; =| error
  • Macro DESTRUCTURING-CCASE (keyform &body clauses)
  • Macro DESTRUCTURING-ECASE (keyform &body clauses)
  • Function COPY-HASH-TABLE (table &key key test size rehash-size rehash-threshold)
    Returns a copy of hash table TABLE, with the same keys and values as the TABLE. The copy has the same properties as the original, unless overridden by the keyword arguments. Before each of the original values is set into the new hash-table, KEY is invoked on the value. As KEY defaults to CL:IDENTITY, a shallow copy is returned by default.
  • Function MAPHASH-KEYS (function table)
    Like MAPHASH, but calls FUNCTION with each key in the hash table TABLE.
  • Function MAPHASH-VALUES (function table)
    Like MAPHASH, but calls FUNCTION with each value in the hash table TABLE.
  • Function HASH-TABLE-KEYS (table)
    Returns a list containing the keys of hash table TABLE.
  • Function HASH-TABLE-VALUES (table)
    Returns a list containing the values of hash table TABLE.
  • Function HASH-TABLE-ALIST (table)
    Returns an association list containing the keys and values of hash table TABLE.
  • Function HASH-TABLE-PLIST (table)
    Returns a property list containing the keys and values of hash table TABLE.
  • Function ALIST-HASH-TABLE (alist &rest hash-table-initargs)
    Returns a hash table containing the keys and values of the association list ALIST. Hash table is initialized using the HASH-TABLE-INITARGS.
  • Function PLIST-HASH-TABLE (plist &rest hash-table-initargs)
    Returns a hash table containing the keys and values of the property list PLIST. Hash table is initialized using the HASH-TABLE-INITARGS.
  • Macro ENSURE-GETHASH (key hash-table &optional default)
    Like GETHASH, but if KEY is not found in the HASH-TABLE saves the DEFAULT under key before returning it. Secondary return value is true if key was already in the table.
  • Macro SWITCH (&whole whole (object &key (test 'eql) (key 'identity)) &body clauses)
    Evaluates first matching clause, returning its values, or evaluates and returns the values of DEFAULT if no keys match.
  • Macro ESWITCH (&whole whole (object &key (test 'eql) (key 'identity)) &body clauses)
    Like SWITCH, but signals an error if no key matches.
  • Macro CSWITCH (&whole whole (object &key (test 'eql) (key 'identity)) &body clauses)
    Like SWITCH, but signals a continuable error if no key matches.
  • Macro WHICHEVER (&rest possibilities &environment env)
    Evaluates exactly one of POSSIBILITIES, chosen at random.
  • Macro XOR (&rest datums)
    Evaluates its arguments one at a time, from left to right. If more than one argument evaluates to a true value no further DATUMS are evaluated, and NIL is returned as both primary and secondary value. If exactly one argument evaluates to true, its value is returned as the primary value after all the arguments have been evaluated, and T is returned as the secondary value. If no arguments evaluate to true NIL is retuned as primary, and T as secondary value.
  • Macro NTH-VALUE-OR (nth-value &body forms)
    Evaluates FORM arguments one at a time, until the NTH-VALUE returned by one of the forms is true. It then returns all the values returned by evaluating that form. If none of the forms return a true nth value, this form returns NIL.
  • Macro MULTIPLE-VALUE-PROG2 (first-form second-form &body forms)
    Evaluates FIRST-FORM, then SECOND-FORM, and then FORMS. Yields as its value all the value returned by SECOND-FORM.
  • Function ENSURE-SYMBOL (name &optional (package *package*))
    Returns a symbol with name designated by NAME, accessible in package designated by PACKAGE. If symbol is not already accessible in PACKAGE, it is interned there. Returns a secondary value reflecting the status of the symbol in the package, which matches the secondary return value of INTERN. Example: (ensure-symbol :cons :cl) => cl:cons, :external
  • Function FORMAT-SYMBOL (package control &rest arguments)
    Constructs a string by applying ARGUMENTS to string designator CONTROL as if by FORMAT within WITH-STANDARD-IO-SYNTAX, and then creates a symbol named by that string. If PACKAGE is NIL, returns an uninterned symbol, if package is T, returns a symbol interned in the current package, and otherwise returns a symbol interned in the package designated by PACKAGE.
  • Function MAKE-KEYWORD (name)
    Interns the string designated by NAME in the KEYWORD package.
  • Function MAKE-GENSYM (name)
    If NAME is a non-negative integer, calls GENSYM using it. Otherwise NAME must be a string designator, in which case calls GENSYM using the designated string as the argument.
  • Function MAKE-GENSYM-LIST (length &optional (x "g"))
    Returns a list of LENGTH gensyms, each generated as if with a call to MAKE-GENSYM, using the second (optional, defaulting to "G") argument.
  • Function SYMBOLICATE (&rest things)
    Concatenate together the names of some strings and symbols, producing a symbol in the current package.
  • Function ENSURE-FUNCTION (function-designator)
    Returns the function designated by FUNCTION-DESIGNATOR: if FUNCTION-DESIGNATOR is a function, it is returned, otherwise it must be a function name and its FDEFINITION is returned.
  • Macro ENSURE-FUNCTIONF (&rest places)
    Multiple-place modify macro for ENSURE-FUNCTION: ensures that each of PLACES contains a function.
  • Function DISJOIN (predicate &rest more-predicates)
    Returns a function that applies each of PREDICATE and MORE-PREDICATE functions in turn to its arguments, returning the primary value of the first predicate that returns true, without calling the remaining predicates. If none of the predicates returns true, NIL is returned.
  • Function CONJOIN (predicate &rest more-predicates)
    Returns a function that applies each of PREDICATE and MORE-PREDICATE functions in turn to its arguments, returning NIL if any of the predicates returns false, without calling the remaining predicates. If none of the predicates returns false, returns the primary value of the last predicate.
  • Function COMPOSE (function &rest more-functions)
    Returns a function composed of FUNCTION and MORE-FUNCTIONS that applies its arguments to to each in turn, starting from the rightmost of MORE-FUNCTIONS, and then calling the next one with the primary value of the last.
  • Function MULTIPLE-VALUE-COMPOSE (function &rest more-functions)
    Returns a function composed of FUNCTION and MORE-FUNCTIONS that applies its arguments to each in turn, starting from the rightmost of MORE-FUNCTIONS, and then calling the next one with all the return values of the last.
  • Function CURRY (function &rest arguments)
    Returns a function that applies ARGUMENTS and the arguments it is called with to FUNCTION.
  • Function RCURRY (function &rest arguments)
    Returns a function that applies the arguments it is called with and ARGUMENTS to FUNCTION.
  • Macro NAMED-LAMBDA (name lambda-list &body body)
    Expands into a lambda-expression within whose BODY NAME denotes the corresponding function.
  • Function ALIST-PLIST (alist)
    Returns a property list containing the same keys and values as the association list ALIST in the same order.
  • Function PLIST-ALIST (plist)
    Returns an association list containing the same keys and values as the property list PLIST in the same order.
  • Function ASSOC-VALUE (alist key &key (test 'eql))
    ASSOC-VALUE is an alist accessor very much like ASSOC, but it can be used with SETF.
  • Function RASSOC-VALUE (alist key &key (test 'eql))
    RASSOC-VALUE is an alist accessor very much like RASSOC, but it can be used with SETF.
  • Macro DOPLIST ((key val plist &optional values) &body body)
    Iterates over elements of PLIST. BODY can be preceded by declarations, and is like a TAGBODY. RETURN may be used to terminate the iteration early. If RETURN is not used, returns VALUES.
  • Macro APPENDF (place &rest lists &environment env)
    Modify-macro for APPEND. Appends LISTS to the place designated by the first argument.
  • Macro NCONCF (place &rest lists &environment env)
    Modify-macro for NCONC. Concatenates LISTS to place designated by the first argument.
  • Macro UNIONF (place list &rest args &environment env)
    Modify-macro for UNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place.
  • Macro NUNIONF (place list &rest args &environment env)
    Modify-macro for NUNION. Saves the union of LIST and the contents of the place designated by the first argument to the designated place. May modify either argument.
  • Macro REVERSEF (place &environment env)
    Modify-macro for REVERSE. Copies and reverses the list stored in the given place and saves back the result into the place.
  • Macro NREVERSEF (place &environment env)
    Modify-macro for NREVERSE. Reverses the list stored in the given place by destructively modifying it and saves back the result into the place.
  • Function CIRCULAR-LIST (&rest elements)
    Creates a circular list of ELEMENTS.
  • Function CIRCULAR-LIST-P (object)
    Returns true if OBJECT is a circular list, NIL otherwise.
  • Function CIRCULAR-TREE-P (object)
    Returns true if OBJECT is a circular tree, NIL otherwise.
  • Function PROPER-LIST-P (object)
    Returns true if OBJECT is a proper list.
  • Type PROPER-LIST
    Type designator for proper lists. Implemented as a SATISFIES type, hence not recommended for performance intensive use. Main usefullness as a type designator of the expected type in a TYPE-ERROR.
  • Function PROPER-LIST-LENGTH (list)
    Returns length of LIST, signalling an error if it is not a proper list.
  • Function LASTCAR (list)
    Returns the last element of LIST. Signals a type-error if LIST is not a proper list.
  • Function (setf LASTCAR) (object list)
    Sets the last element of LIST. Signals a type-error if LIST is not a proper list.
  • Function MAKE-CIRCULAR-LIST (length &key initial-element)
    Creates a circular list of LENGTH with the given INITIAL-ELEMENT.
  • Type CIRCULAR-LIST
    Type designator for circular lists. Implemented as a SATISFIES type, so not recommended for performance intensive use. Main usefullness as the expected-type designator of a TYPE-ERROR.
  • Function ENSURE-CAR (thing)
    If THING is a CONS, its CAR is returned. Otherwise THING is returned.
  • Function ENSURE-CONS (cons)
    If CONS is a cons, it is returned. Otherwise returns a fresh cons with CONS in the car, and NIL in the cdr.
  • Function ENSURE-LIST (list)
    If LIST is a list, it is returned. Otherwise returns the list designated by LIST.
  • Function REMOVE-FROM-PLIST (plist &rest keys)
    Returns a propery-list with same keys and values as PLIST, except that keys in the list designated by KEYS and values corresponding to them are removed. The returned property-list may share structure with the PLIST, but PLIST is not destructively modified. Keys are compared using EQ.
  • Function DELETE-FROM-PLIST (plist &rest keys)
    Just like REMOVE-FROM-PLIST, but this version may destructively modify the provided plist.
  • Macro REMOVE-FROM-PLISTF (place &rest keys &environment env)
    Modify macro for REMOVE-FROM-PLIST.
  • Macro DELETE-FROM-PLISTF (place &rest keys &environment env)
    Modify macro for DELETE-FROM-PLIST.
  • Function MAPPEND (function &rest lists)
    Applies FUNCTION to respective element(s) of each LIST, appending all the all the result list to a single list. FUNCTION must return a list.
  • Function SETP (object &key (test #'eql) (key #'identity))
    Returns true if OBJECT is a list that denotes a set, NIL otherwise. A list denotes a set if each element of the list is unique under KEY and TEST.
  • Function SET-EQUAL (list1 list2 &key (test #'eql) (key nil keyp))
    Returns true if every element of LIST1 matches some element of LIST2 and every element of LIST2 matches some element of LIST1. Otherwise returns false.
  • Function MAP-PRODUCT (function list &rest more-lists)
    Returns a list containing the results of calling FUNCTION with one argument from LIST, and one from each of MORE-LISTS for each combination of arguments. In other words, returns the product of LIST and MORE-LISTS using FUNCTION. Example: (map-product 'list '(1 2) '(3 4) '(5 6)) => ((1 3 5) (1 3 6) (1 4 5) (1 4 6) (2 3 5) (2 3 6) (2 4 5) (2 4 6))
  • Function FLATTEN (tree)
    Traverses the tree in order, collecting non-null leaves into a list.
  • Type ARRAY-INDEX (&optional (length (1- array-dimension-limit)))
    Type designator for an index into array of LENGTH: an integer between 0 (inclusive) and LENGTH (exclusive). LENGTH defaults to one less than ARRAY-DIMENSION-LIMIT.
  • Type ARRAY-LENGTH (&optional (length (1- array-dimension-limit)))
    Type designator for a dimension of an array of LENGTH: an integer between 0 (inclusive) and LENGTH (inclusive). LENGTH defaults to one less than ARRAY-DIMENSION-LIMIT.
  • Type NEGATIVE-FIXNUM
    Type specifier denoting the fixnum range from MOST-NEGATIVE-FIXNUM to -1.
  • Type NON-POSITIVE-FIXNUM
    Type specifier denoting the fixnum range from MOST-NEGATIVE-FIXNUM to 0.
  • Type NON-NEGATIVE-FIXNUM
    Type specifier denoting the fixnum range from 0 to MOST-POSITIVE-FIXNUM.
  • Type POSITIVE-FIXNUM
    Type specifier denoting the fixnum range from 1 to MOST-POSITIVE-FIXNUM.
  • Function NEGATIVE-FIXNUM-P (n)
  • Function NON-POSITIVE-FIXNUM-P (n)
  • Function NON-NEGATIVE-FIXNUM-P (n)
  • Function POSITIVE-FIXNUM-P (n)
  • Type NEGATIVE-INTEGER
    Type specifier denoting the integer range from -inf to -1.
  • Type NON-POSITIVE-INTEGER
    Type specifier denoting the integer range from -inf to 0.
  • Type NON-NEGATIVE-INTEGER
    Type specifier denoting the integer range from 0 to +inf.
  • Type POSITIVE-INTEGER
    Type specifier denoting the integer range from 1 to +inf.
  • Function NEGATIVE-INTEGER-P (n)
  • Function NON-POSITIVE-INTEGER-P (n)
  • Function NON-NEGATIVE-INTEGER-P (n)
  • Function POSITIVE-INTEGER-P (n)
  • Type NEGATIVE-RATIONAL
    Type specifier denoting the rational range from -inf to 0.
  • Type NON-POSITIVE-RATIONAL
    Type specifier denoting the rational range from -inf to 0.
  • Type NON-NEGATIVE-RATIONAL
    Type specifier denoting the rational range from 0 to +inf.
  • Type POSITIVE-RATIONAL
    Type specifier denoting the rational range from 0 to +inf.
  • Function NEGATIVE-RATIONAL-P (n)
  • Function NON-POSITIVE-RATIONAL-P (n)
  • Function NON-NEGATIVE-RATIONAL-P (n)
  • Function POSITIVE-RATIONAL-P (n)
  • Type NEGATIVE-REAL
    Type specifier denoting the real range from -inf to 0.
  • Type NON-POSITIVE-REAL
    Type specifier denoting the real range from -inf to 0.
  • Type NON-NEGATIVE-REAL
    Type specifier denoting the real range from 0 to +inf.
  • Type POSITIVE-REAL
    Type specifier denoting the real range from 0 to +inf.
  • Function NEGATIVE-REAL-P (n)
  • Function NON-POSITIVE-REAL-P (n)
  • Function NON-NEGATIVE-REAL-P (n)
  • Function POSITIVE-REAL-P (n)
  • Type NEGATIVE-FLOAT
    Type specifier denoting the float range from -inf to 0.0.
  • Type NON-POSITIVE-FLOAT
    Type specifier denoting the float range from -inf to 0.0.
  • Type NON-NEGATIVE-FLOAT
    Type specifier denoting the float range from 0.0 to +inf.
  • Type POSITIVE-FLOAT
    Type specifier denoting the float range from 0.0 to +inf.
  • Function NEGATIVE-FLOAT-P (n)
  • Function NON-POSITIVE-FLOAT-P (n)
  • Function NON-NEGATIVE-FLOAT-P (n)
  • Function POSITIVE-FLOAT-P (n)
  • Type NEGATIVE-SHORT-FLOAT
    Type specifier denoting the short-float range from -inf to 0.0.
  • Type NON-POSITIVE-SHORT-FLOAT
    Type specifier denoting the short-float range from -inf to 0.0.
  • Type NON-NEGATIVE-SHORT-FLOAT
    Type specifier denoting the short-float range from 0.0 to +inf.
  • Type POSITIVE-SHORT-FLOAT
    Type specifier denoting the short-float range from 0.0 to +inf.
  • Function NEGATIVE-SHORT-FLOAT-P (n)
  • Function NON-POSITIVE-SHORT-FLOAT-P (n)
  • Function NON-NEGATIVE-SHORT-FLOAT-P (n)
  • Function POSITIVE-SHORT-FLOAT-P (n)
  • Type NEGATIVE-SINGLE-FLOAT
    Type specifier denoting the single-float range from -inf to 0.0.
  • Type NON-POSITIVE-SINGLE-FLOAT
    Type specifier denoting the single-float range from -inf to 0.0.
  • Type NON-NEGATIVE-SINGLE-FLOAT
    Type specifier denoting the single-float range from 0.0 to +inf.
  • Type POSITIVE-SINGLE-FLOAT
    Type specifier denoting the single-float range from 0.0 to +inf.
  • Function NEGATIVE-SINGLE-FLOAT-P (n)
  • Function NON-POSITIVE-SINGLE-FLOAT-P (n)
  • Function NON-NEGATIVE-SINGLE-FLOAT-P (n)
  • Function POSITIVE-SINGLE-FLOAT-P (n)
  • Type NEGATIVE-DOUBLE-FLOAT
    Type specifier denoting the double-float range from -inf to 0.0d0.
  • Type NON-POSITIVE-DOUBLE-FLOAT
    Type specifier denoting the double-float range from -inf to 0.0d0.
  • Type NON-NEGATIVE-DOUBLE-FLOAT
    Type specifier denoting the double-float range from 0.0d0 to +inf.
  • Type POSITIVE-DOUBLE-FLOAT
    Type specifier denoting the double-float range from 0.0d0 to +inf.
  • Function NEGATIVE-DOUBLE-FLOAT-P (n)
  • Function NON-POSITIVE-DOUBLE-FLOAT-P (n)
  • Function NON-NEGATIVE-DOUBLE-FLOAT-P (n)
  • Function POSITIVE-DOUBLE-FLOAT-P (n)
  • Type NEGATIVE-LONG-FLOAT
    Type specifier denoting the long-float range from -inf to 0.0d0.
  • Type NON-POSITIVE-LONG-FLOAT
    Type specifier denoting the long-float range from -inf to 0.0d0.
  • Type NON-NEGATIVE-LONG-FLOAT
    Type specifier denoting the long-float range from 0.0d0 to +inf.
  • Type POSITIVE-LONG-FLOAT
    Type specifier denoting the long-float range from 0.0d0 to +inf.
  • Function NEGATIVE-LONG-FLOAT-P (n)
  • Function NON-POSITIVE-LONG-FLOAT-P (n)
  • Function NON-NEGATIVE-LONG-FLOAT-P (n)
  • Function POSITIVE-LONG-FLOAT-P (n)
  • Function OF-TYPE (type)
    Returns a function of one argument, which returns true when its argument is of TYPE.
  • Function TYPE= (type1 type2)
    Returns a primary value of T is TYPE1 and TYPE2 are the same type, and a secondary value that is true is the type equality could be reliably determined: primary value of NIL and secondary value of T indicates that the types are not equivalent.
  • Macro COERCEF (place type-spec &environment env)
    Modify-macro for COERCE.
  • Function COPY-ARRAY (array &key (element-type (array-element-type array)) (fill-pointer (and (array-has-fill-pointer-p array) (fill-pointer array))) (adjustable (adjustable-array-p array)))
    Returns an undisplaced copy of ARRAY, with same fill-pointer and adjustability (if any) as the original, unless overridden by the keyword arguments.
  • Function SEQUENCE-OF-LENGTH-P (sequence length)
    Return true if SEQUENCE is a sequence of length LENGTH. Signals an error if SEQUENCE is not a sequence. Returns FALSE for circular lists.
  • Function ROTATE (sequence &optional (n 1))
    Returns a sequence of the same type as SEQUENCE, with the elements of SEQUENCE rotated by N: N elements are moved from the end of the sequence to the front if N is positive, and -N elements moved from the front to the end if N is negative. SEQUENCE must be a proper sequence. N must be an integer, defaulting to 1. If absolute value of N is greater then the length of the sequence, the results are identical to calling ROTATE with (* (signum n) (mod n (length sequence))). Note: the original sequence may be destructively altered, and result sequence may share structure with it.
  • Function SHUFFLE (sequence &key (start 0) end)
    Returns a random permutation of SEQUENCE bounded by START and END. Original sequece may be destructively modified, and share storage with the original one. Signals an error if SEQUENCE is not a proper sequence.
  • Function RANDOM-ELT (sequence &key (start 0) end)
    Returns a random element from SEQUENCE bounded by START and END. Signals an error if the SEQUENCE is not a proper non-empty sequence, or if END and START are not proper bounding index designators for SEQUENCE.
  • Macro REMOVEF (place item &rest remove-keywords &environment env)
    Modify-macro for REMOVE. Sets place designated by the first argument to the result of calling REMOVE with ITEM, place, and the REMOVE-KEYWORDS.
  • Macro DELETEF (place item &rest remove-keywords &environment env)
    Modify-macro for DELETE. Sets place designated by the first argument to the result of calling DELETE with ITEM, place, and the REMOVE-KEYWORDS.
  • Type PROPER-SEQUENCE
    Type designator for proper sequences, that is proper lists and sequences that are not lists.
  • Function LENGTH= (&rest sequences)
    Takes any number of sequences or integers in any order. Returns true iff the length of all the sequences and the integers are equal. Hint: there's a compiler macro that expands into more efficient code if the first argument is a literal integer.
  • Function COPY-SEQUENCE (type sequence)
    Returns a fresh sequence of TYPE, which has the same elements as SEQUENCE.
  • Function FIRST-ELT (sequence)
    Returns the first element of SEQUENCE. Signals a type-error if SEQUENCE is not a sequence, or is an empty sequence.
  • Function (setf FIRST-ELT) (object sequence)
    Sets the first element of SEQUENCE. Signals a type-error if SEQUENCE is not a sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE.
  • Function LAST-ELT (sequence)
    Returns the last element of SEQUENCE. Signals a type-error if SEQUENCE is not a proper sequence, or is an empty sequence.
  • Function (setf LAST-ELT) (object sequence)
    Sets the last element of SEQUENCE. Signals a type-error if SEQUENCE is not a proper sequence, is an empty sequence, or if OBJECT cannot be stored in SEQUENCE.
  • Function STARTS-WITH-SUBSEQ (prefix sequence &rest args &key (return-suffix nil return-suffix-supplied-p) &allow-other-keys)
    Test whether the first elements of SEQUENCE are the same (as per TEST) as the elements of PREFIX. If RETURN-SUFFIX is T the function returns, as a second value, a sub-sequence or displaced array pointing to the sequence after PREFIX.
  • Function ENDS-WITH-SUBSEQ (suffix sequence &key (test #'eql))
    Test whether SEQUENCE ends with SUFFIX. In other words: return true if the last (length SUFFIX) elements of SEQUENCE are equal to SUFFIX.
  • Function STARTS-WITH (object sequence &key (test #'eql) (key #'identity))
    Returns true if SEQUENCE is a sequence whose first element is EQL to OBJECT. Returns NIL if the SEQUENCE is not a sequence or is an empty sequence.
  • Function ENDS-WITH (object sequence &key (test #'eql) (key #'identity))
    Returns true if SEQUENCE is a sequence whose last element is EQL to OBJECT. Returns NIL if the SEQUENCE is not a sequence or is an empty sequence. Signals an error if SEQUENCE is an improper list.
  • Function MAP-COMBINATIONS (function sequence &key (start 0) end length (copy t))
    Calls FUNCTION with each combination of LENGTH constructable from the elements of the subsequence of SEQUENCE delimited by START and END. START defaults to 0, END to length of SEQUENCE, and LENGTH to the length of the delimited subsequence. (So unless LENGTH is specified there is only a single combination, which has the same elements as the delimited subsequence.) If COPY is true (the default) each combination is freshly allocated. If COPY is false all combinations are EQ to each other, in which case consequences are specified if a combination is modified by FUNCTION.
  • Function MAP-PERMUTATIONS (function sequence &key (start 0) end length (copy t))
    Calls function with each permutation of LENGTH constructable from the subsequence of SEQUENCE delimited by START and END. START defaults to 0, END to length of the sequence, and LENGTH to the length of the delimited subsequence.
  • Function MAP-DERANGEMENTS (function sequence &key (start 0) end (copy t))
    Calls FUNCTION with each derangement of the subsequence of SEQUENCE denoted by the bounding index designators START and END. Derangement is a permutation of the sequence where no element remains in place. SEQUENCE is not modified, but individual derangements are EQ to each other. Consequences are unspecified if calling FUNCTION modifies either the derangement or SEQUENCE.
  • Function EXTREMUM (sequence predicate &key key (start 0) end)
    Returns the element of SEQUENCE that would appear first if the subsequence bounded by START and END was sorted using PREDICATE and KEY. EXTREMUM determines the relationship between two elements of SEQUENCE by using the PREDICATE function. PREDICATE should return true if and only if the first argument is strictly less than the second one (in some appropriate sense). Two arguments X and Y are considered to be equal if (FUNCALL PREDICATE X Y) and (FUNCALL PREDICATE Y X) are both false. The arguments to the PREDICATE function are computed from elements of SEQUENCE using the KEY function, if supplied. If KEY is not supplied or is NIL, the sequence element itself is used. If SEQUENCE is empty, NIL is returned.
  • Function CLAMP (number min max)
    Clamps the NUMBER into [min, max] range. Returns MIN if NUMBER is lesser then MIN and MAX if NUMBER is greater then MAX, otherwise returns NUMBER.
  • Function GAUSSIAN-RANDOM (&optional min max)
    Returns two gaussian random double floats as the primary and secondary value, optionally constrained by MIN and MAX. Gaussian random numbers form a standard normal distribution around 0.0d0. Sufficiently positive MIN or negative MAX will cause the algorithm used to take a very long time. If MIN is positive it should be close to zero, and similarly if MAX is negative it should be close to zero.
  • Function IOTA (n &key (start 0) (step 1))
    Return a list of n numbers, starting from START (with numeric contagion from STEP applied), each consequtive number being the sum of the previous one and STEP. START defaults to 0 and STEP to 1. Examples: (iota 4) => (0 1 2 3) (iota 3 :start 1 :step 1.0) => (1.0 2.0 3.0) (iota 3 :start -1 :step -1/2) => (-1 -3/2 -2)
  • Function MAP-IOTA (function n &key (start 0) (step 1))
    Calls FUNCTION with N numbers, starting from START (with numeric contagion from STEP applied), each consequtive number being the sum of the previous one and STEP. START defaults to 0 and STEP to 1. Returns N. Examples: (map-iota #'print 3 :start 1 :step 1.0) => 3 ;;; 1.0 ;;; 2.0 ;;; 3.0
  • Function LERP (v a b)
    Returns the result of linear interpolation between A and B, using the interpolation coefficient V.
  • Function MEAN (sample)
    Returns the mean of SAMPLE. SAMPLE must be a sequence of numbers.
  • Function MEDIAN (sample)
    Returns median of SAMPLE. SAMPLE must be a sequence of real numbers.
  • Function VARIANCE (sample &key (biased t))
    Variance of SAMPLE. Returns the biased variance if BIASED is true (the default), and the unbiased estimator of variance if BIASED is false. SAMPLE must be a sequence of numbers.
  • Function STANDARD-DEVIATION (sample &key (biased t))
    Standard deviation of SAMPLE. Returns the biased standard deviation if BIASED is true (the default), and the square root of the unbiased estimator for variance if BIASED is false (which is not the same as the unbiased estimator for standard deviation). SAMPLE must be a sequence of numbers.
  • Macro MAXF (place &rest numbers &environment env)
    Modify-macro for MAX. Sets place designated by the first argument to the maximum of its original value and NUMBERS.
  • Macro MINF (place &rest numbers &environment env)
    Modify-macro for MIN. Sets place designated by the first argument to the minimum of its original value and NUMBERS.
  • Function FACTORIAL (n)
    Factorial of non-negative integer N.
  • Function BINOMIAL-COEFFICIENT (n k)
    Binomial coefficient of N and K, also expressed as N choose K. This is the number of K element combinations given N choises. N must be equal to or greater then K.
  • Function SUBFACTORIAL (n)
    Subfactorial of the non-negative integer N.
  • Function COUNT-PERMUTATIONS (n &optional (k n))
    Number of K element permutations for a sequence of N objects. K defaults to N
  • Function FEATUREP (feature-expression)
    Returns T if the argument matches the state of the *FEATURES* list and NIL if it does not. FEATURE-EXPRESSION can be any atom or list acceptable to the reader macros #+ and #-.

alexandria-tests

Tests for Alexandria, which is a collection of portable public domain utilities.

ALEXANDRIA-TESTS

No exported symbols.