The jpl-util Reference Manual

This is the jpl-util Reference Manual, version 0.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:03:34 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 jpl-util

Sundry utilities for J.P. Larocque.

Maintainer

J.P. Larocque

Author

J.P. Larocque

License

ISC-style permissive

Version

0.4

Source

jpl-util.asd.

Child Components

2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 jpl-util/jpl-util.asd

Source

jpl-util.asd.

Parent Component

jpl-util (system).

ASDF Systems

jpl-util.


2.1.2 jpl-util/jpl-util.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface
Internals

2.1.3 jpl-util/vector-delete.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface
Internals

2.1.4 jpl-util/gensyms.lisp

Dependency

package.lisp (file).

Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

with-gensyms (macro).


2.1.5 jpl-util/types.lisp

Dependency

package.lisp (file).

Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.6 jpl-util/accumulators.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.7 jpl-util/iterators.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.8 jpl-util/subtypecase.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.9 jpl-util/option-clause.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

option-clause-bind (macro).

Internals

option-clause-list->plist (function).


2.1.10 jpl-util/alists-and-plists.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.11 jpl-util/defclass-star.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

defclass* (macro).


2.1.12 jpl-util/order.lisp

Dependencies
Source

jpl-util.asd.

Parent Component

jpl-util (system).

Public Interface

2.1.13 jpl-util/package.lisp

Source

jpl-util.asd.

Parent Component

jpl-util (system).

Packages

jpl-util.


3 Packages

Packages are listed by definition order.


3.1 jpl-util

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Special variables

Special Variable: *verbose*

Whether to be verbose when evaluating forms expressed in VERBOSELY.

Package

jpl-util.

Source

jpl-util.lisp.


4.1.2 Macros

Macro: 1or (&rest forms)

Returns true if and only if exactly one of the given forms returns true. The single true value returned by one of the forms is returned. Each form is evaluated at most once, and the forms are evaluated in an unspecified order. If no forms are given, NIL is returned.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: accumulate-to-dynamic-vector ((set-element-type accumulate) &body body)

Evaluates BODY, accumulating elements to a fresh vector, resulting in the vector (which will be adjustable and have a fill-pointer). The number of elements to be accumulated does not have to be determined before accumulation begins. The order of the elements of the resulting vector is the order in which they are accumulated.

The symbols given by SET-ELEMENT-TYPE and ACCUMULATE name lexically-defined macros:

(SET-ELEMENT-TYPE &optional ELEMENT-TYPE)
Must be evaluated once, before ACCUMULATE is evaluated for the first time.

ELEMENT-TYPE (evaluated) specifies the array element type of the resulting vector. The default is T. The result of accumulating an element not of type ELEMENT-TYPE is undefined.

(ACCUMULATE ELEMENT)
Accumulates ELEMENT (evaluated) to the vector. ACCUMULATE may be evaluated any number of times.

Package

jpl-util.

Source

accumulators.lisp.

Macro: accumulate-to-hash-table ((set-test/size accumulate) &body body)

Evaluates BODY, accumulating key and value pairs to a fresh hash-table, resulting in the hash-table.

The symbols given by SET-TEST/SIZE and ACCUMULATE name lexically-defined macros:

(SET-TEST/SIZE TEST &optional SIZE)
Must be evaluated once, before ACCUMULATE is evaluated for the first time.

TEST (evaluated) must be a designator for one of the test functions acceptable to MAKE-HASH-TABLE.

If SIZE is specified and non-NIL, it is evaluated to produce a non-negative integer which specifies the expected number of unique entries to accumulate. The actual number of entries may vary, but accumulation may be slower or use more memory than if the size had been correctly predicted.

(ACCUMULATE KEY VALUE)
Accumulates an entry of KEY and VALUE (both evaluated) to the hash-table, replacing any previous entry with the same KEY. ACCUMULATE may be evaluated any number of times.

Package

jpl-util.

Source

accumulators.lisp.

Macro: accumulate-to-list ((accumulate) &body body)

Evaluates BODY, accumulating elements to a fresh list, resulting in the list. The order of the elements of the resulting list is the order in which they are accumulated.

The symbol given by ACCUMULATE names a lexically-defined macro:

(ACCUMULATE ELEMENT)
Accumulates ELEMENT (evaluated) to the list. ACCUMULATE may be evaluated any number of times.

Package

jpl-util.

Source

accumulators.lisp.

Macro: accumulate-to-vector ((set-size/element-type accumulate) &body body)

Evaluates BODY, accumulating elements to a fresh vector, resulting in the vector. The number of elements to be accumulated must be determined before accumulation begins. The order of the elements of the resulting vector is the order in which they are accumulated.

The symbols given by SET-SIZE/ELEMENT-TYPE and ACCUMULATE name lexically-defined macros:

(SET-SIZE/ELEMENT-TYPE SIZE &optional ELEMENT-TYPE)
Must be evaluated once, before ACCUMULATE is evaluated for the first time.

SIZE (evaluated) specifies the length of the resulting vector.
ELEMENT-TYPE (evaluated) specifies the array element type of the resulting vector. The default is T. The result of accumulating an element not of type ELEMENT-TYPE is undefined.

(ACCUMULATE ELEMENT)
Accumulates ELEMENT (evaluated) to the vector.

ACCUMULATE must never be evaluated more times than the size of the vector. At the time BODY returns normally, ACCUMULATE must have been called exactly the number of times as the size of the vector. ACCUMULATE may be evaluated fewer times when BODY makes a non-local exit.

Package

jpl-util.

Source

accumulators.lisp.

Macro: check-type* (expression typespec &optional string)

Like CHECK-TYPE, with two differences: this tests any expression, not just a place. If an error is signalled, it won’t be correctable.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: composite-lesser? (&body clauses)

Returns a generalized boolean indicating whether one thing is less than another thing according to the rules defined by CLAUSES.

Each thing (neither of which is explicitly expressed as an argument) should conceptually be deconstructable to an equal number of comparable parts. Each part of both things is compared in parallel, beginning with the first part of the things, followed by the next part of the things, and so on. One thing is less than another thing when it has a part which is less than the other thing’s corresponding part, and all part pairs prior to the differing part pair compare as equal.

Each clause represents a part to test. A clause is of the form:

(TEST OBJ1 OBJ2)

OBJ1 and OBJ2 are expressions which produce parts of the first and second thing, respectively. TEST is evaluated to produce a function of two arguments, which is applied to the two objects (in both orders) to determine which one is lesser than the other, if any.

Additionally, the final clause may take the form:

(:OTHERWISE &body OTHERWISE-BODY)

When this is so, and no differences are found by testing each pair of parts, then the result–rather than NIL–is the evaluation of OTHERWISE-BODY as an implicit progn. This facilitates the comparison of two things which have a variable number of parts; OTHERWISE-BODY would test the tails of the parts which occur after the parts tested for with ordinary clauses.

TEST, OBJ1, and OBJ2 for any given clause, and OTHERWISE-BODY, will be evaluated at most once, but evaluation (and hence calling the function expressed by TEST) may be short-circuited if testing an earlier part proves that later part comparisons are irrelevant.

Package

jpl-util.

Source

order.lisp.

Macro: csubtypecase (key-place &body clauses)

As with SUBTYPECASE, but signals a correctable error of type SUBTYPE-ERROR if no clause matches. The STORE-VALUE restart can be used to correct the error. No otherwise clause is allowed. Analogous to CTYPECASE.

Package

jpl-util.

Source

subtypecase.lisp.

Macro: defclass* (class-name (&rest superclass-names) (&rest slot-specifiers) &rest class-options)

Defines a class just like DEFCLASS does, but adds reasonable default options to each slot.

:INITARG is defined, with the slot name as a keyword.

:INITFORM is defined, with an ERROR form that signals a SIMPLE-ERROR with a generic message, "Must supply [INITARG]."

A reader, writer, or accessor is defined, with the same name as the slot. By default, a reader is defined; you may override the selection with the special slot option JPL-UTIL:ACCESSOR-TYPE, with a value of :READER, :WRITER, or :ACCESSOR. The name of the reader, writer, or accessor may be overridden with the special slot option JPL-UTIL:ACCESSOR-NAME. If either value of JPL-UTIL:ACCESSOR-TYPE or JPL-UTIL:ACCESSOR-NAME are NIL, then no reader, writer, or accessor is defined.

Any default slot option may be overridden by explicitly specifying a value for that slot option. For example, if you don’t like the default value for :INITFORM, you may specify :INITFORM NIL.

Default slot option may be omitted by giving the special slot option JPL-UTIL:OMIT-OPTIONS with a list of default slot option indicators to suppress. For example, if you don’t want an :INITFORM option, you may specify JPL-UTIL:OMIT-OPTIONS (:INITFORM).

Package

jpl-util.

Source

defclass-star.lisp.

Macro: defvar-unbound (name &optional doc-string)

Convenience macro to declare unbound special variables with a documentation string.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: doseq ((var sequence-form &optional result-form) &body body)

Iterates over the elements of the sequence produced by evaluating SEQUENCE-FORM similarly to DOLIST.

BODY may be included in the expansion more than once, for specialization on the different types of sequences without the overhead of function calls.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: esubtypecase (key-form &body clauses)

As with SUBTYPECASE, but signals SUBTYPE-ERROR if no clause matches. No otherwise clause is allowed. Analogous to ETYPECASE.

Package

jpl-util.

Source

subtypecase.lisp.

Macro: lambda* (args &body body)

Creates a function. Takes an extended, rather than an ordinary, lambda list.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: lesser? ((value1 value2 least-possible-value) &body body)

Evaluates to whether VALUE1 is less than VALUE2 when there is the possibility that either are EQ to LEAST-POSSIBLE-VALUE. One value is always less than the other when it is EQ to LEAST-POSSIBLE-VALUE and the other is not. If the answer cannot be determined by comparing VALUE1 and VALUE2 with LEAST-POSSIBLE-VALUE, then BODY is evaluated.

VALUE1, VALUE2, and LEAST-POSSIBLE-VALUE may or may not be evaluated, and in any order. BODY is evaluated only when neither values are EQ to LEAST-POSSIBLE-VALUE.

Package

jpl-util.

Source

order.lisp.

Macro: list-extract! (list predicate &key mapping-p)

Returns those items in list that pass the predicate, removing them destructively from the input. When mapping-p is true, returns the result of the predicate function for each element, rather than the elements themselves.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: option-clause-bind (lambda-list expression &body body)

Evaluates EXPRESSION to produce a list of "option clauses," then evaluates BODY with the variables of LAMBDA-LIST bound to the values of the option clauses.

An option clause is a cons of the form (NAME . VALUE), where each NAME is unique. A list of option clauses looks a lot like an association list, with the difference being that no value is allowed to be the NAME of more than one option clause.

Although the term "option clause" is not used in the Common Lisp HyperSpec, the syntax of some Common Lisp macros call for expressing options in this style. DEFCLASS and DEFGENERIC are among these macros.

LAMBDA-LIST is just like a sequence of variable specifications in the &KEY section of a destructuring lambda list. Each member of LAMBDA-LIST designates one value of NAME to match from the list of option clauses, and must take one of the following forms:

VAR

If the keyword name appears as the name of an option clause, VAR is bound to the value of that option clause. Otherwise, VAR is bound to NIL.

The keyword name is a keyword with the same name as VAR.

VAR must be a symbol which is not a lambda list keyword.

({VAR | (KEYWORD-NAME VAR)} [INIT-FORM [SUPPLIED-P-PARAMETER]])
If the keyword name appears as the name of an option clause, VAR is bound to the value of that option clause. Otherwise, if INIT-FORM is supplied, VAR is bound to the result of evaluating INIT-FORM. Otherwise, VAR is bound to NIL.

SUPPLIED-P-PARAMETER, when supplied, is bound to a boolean value indicating whether a matching option clause was found. When the bound value is true, INIT-FORM will not have been evaluated. When the value is false, INIT-FORM (if supplied) will have been evaluated.

When KEYWORD-NAME is supplied, it is used as the keyword name; otherwise, a keyword with the same name as VAR is used.

When supplied, VAR and SUPPLIED-P-PARAMETER must be symbols, INIT-FORM must be a form, and KEYWORD-NAME may be any value.

For example:

(option-clause-bind (foo bar) ’((:foo 1 2) (:bar 3)) . BODY) == (destructuring-bind (&key foo bar) ’(:foo (1 2) :bar (3)) . BODY)

Due to the constraint that NAMEs must be unique, note that:

(option-clause-bind VARS EXPRESSION . BODY) NOT== (destructuring-bind (&key . VARS) (alist->plist EXPRESSION) . BODY)

Package

jpl-util.

Source

option-clause.lisp.

Macro: push-append (list place)

Prepends the contents of LIST onto the list stored in PLACE. The resulting list is stored in PLACE and then returned.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: push-nconc (list place)

Destructively prepends the contents of LIST onto the list stored in PLACE. The resulting list is stored in PLACE and then returned.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: subtypecase (key-form &body clauses)

Evaluates the code associated with the first clause which lists a type which KEY-FORM (which is evaluated) a recognizable subtype of. If there is no match, NIL is returned. SUBTYPECASE is to SUBTYPEP as TYPECASE is to TYPEP.

The syntax of clauses, including the syntax of an optional trailing otherwise-clause, is the same as in TYPECASE.

Package

jpl-util.

Source

subtypecase.lisp.

Macro: verbosely ((control-string &rest format-arguments) &body body)
Package

jpl-util.

Source

jpl-util.lisp.

Macro: with-accessors* ((&rest accessors) instance-form &body body)

Like WITH-ACCESSORS, except that instead of giving (VARIABLE-NAME ACCESSOR-NAME) for each accessor, you may give VARIABLE-NAME, in which case ACCESSOR-NAME is derived from it.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: with-extent-hooks ((enter return non-local-exit) &body body)

Evaluates BODY, and evaluates the given forms upon certain situations relating to the dynamic extent of the evaluation of BODY.

ENTER must be a form. Just before dynamic extent enters BODY, ENTER is evaluated. The return values of ENTER are discarded.

RETURN must be a list of the form (LAMBDA-LIST &BODY RETURN-BODY), or NIL. If BODY returns and RETURN is not NIL, RETURN-BODY (an implicit progn) is evaluated with the variables of LAMBDA-LIST (an ordinary lambda list) bound to the return values of BODY. The return values of RETURN-BODY are discarded. The return values of BODY are returned by WITH-EXTENT-HOOKS.

NON-LOCAL-EXIT must be a form. If dynamic extent leaves BODY due to a non-local exit (including due to a signalled condition), NON-LOCAL-EXIT is evaluated. The return values of NON-LOCAL-EXIT are discarded.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: with-gensyms ((&rest names) &body body)

Evaluates BODY with each variable name of NAMES bound to a unique, fresh, uninterned symbol.

Package

jpl-util.

Source

gensyms.lisp.

Macro: with-list-iterator ((next size exhausted? list-form) &body body)

Evaluates BODY with an iterator on a list.

LIST-FORM is evaluated once to produce the list to iterate upon. The resulting list is never modified (unless from within BODY–the consequences of which are undefined).

The symbols given by NEXT, SIZE, and EXHAUSTED? name lexically-defined macros:

(NEXT)
Yields the next successive element of the list. The consequences of evaluating (NEXT) more times than the length of the list is undefined.

(SIZE)
Evaluates to the length of the list. The list is only traversed for only the first evaluation; the length is memoized.

(EXHAUSTED?)
Evaluates to a generalized boolean indicating whether the list has been exhausted by evaluations of (NEXT).

Package

jpl-util.

Source

iterators.lisp.

Macro: with-range-iterator ((next size exhausted? lower-form upper-form) &body body)

Evaluates BODY with an iterator on a range of integers.

LOWER-FORM and UPPER-FORM are evaluated once to produce the range of integers, [LOWER,UPPER), to iterate upon.

The symbols given by NEXT, SIZE, and EXHAUSTED? name lexically-defined macros:

(NEXT)
Yields the next successive element of the range. The consequences of evaluating (NEXT) more times than the length of the range is undefined.

(SIZE)
Evaluates to the length of the range.

(EXHAUSTED?)
Evaluates to a generalized boolean indicating whether the range has been exhausted by evaluations of (NEXT).

Package

jpl-util.

Source

iterators.lisp.

Macro: with-safe-alloc ((var alloc free) &rest body)

Binds VAR to NIL, then sets it to the result of evaluating ALLOC. Upon exit of dynamic extent, as long as the value of VAR is not NIL (such as by a condition signalled by evaluating ALLOC), FREE is evaluated.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: with-sequence-iterator ((next size exhausted? sequence-form) &body body)

Evaluates BODY with an iterator on a SEQUENCE.

SEQUENCE-FORM is evaluated once to produce the sequence to iterate upon. The resulting sequence is never modified (unless from within BODY–the consequences of which are undefined). If the sequence is a vector with a fill-pointer, the fill-pointer is respected.

The symbols given by NEXT, SIZE, and EXHAUSTED? name lexically-defined macros:

(NEXT)
Yields the next successive element of the sequence. The consequences of evaluating (NEXT) more times than the length of the sequence is undefined.

(SIZE)
Evaluates to the length of the sequence.

(EXHAUSTED?)
Evaluates to a generalized boolean indicating whether the sequence has been exhausted by evaluations of (NEXT).

Package

jpl-util.

Source

iterators.lisp.

Macro: with-trace ((&optional id) &body body)

Like TRACE, but for the given body of code. Specify an ID (a number or symbol) to avoid the conceptually-same code from clogging up the output of LIST-TRACES as this code gets redefined several times.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: with-vector-iterator ((next size exhausted? vector-form) &body body)

Evaluates BODY with an iterator on a vector.

VECTOR-FORM is evaluated once to produce the vector to iterate upon. The resulting vector is never modified (unless from within BODY–the consequences of which are undefined). If the vector has a fill-pointer, it is respected.

The symbols given by NEXT, SIZE, and EXHAUSTED? name lexically-defined macros:

(NEXT)
Yields the next successive element of the vector. The consequences of evaluating (NEXT) more times than the length of the vector is undefined.

(SIZE)
Evaluates to the length of the vector.

(EXHAUSTED?)
Evaluates to a generalized boolean indicating whether the vector has been exhausted by evaluations of (NEXT).

Package

jpl-util.

Source

iterators.lisp.

Macro: with-verbosity ((&optional verbose) &body body)
Package

jpl-util.

Source

jpl-util.lisp.

Macro: xor (&rest forms)

Returns the logical exclusive-or of the generalized boolean value of each form: true if and only if there are an even number of forms that return true. Each form is evaluated once, and the forms are evaluated in an unspecified order. If no forms are given, NIL is returned.

Package

jpl-util.

Source

jpl-util.lisp.


4.1.3 Compiler macros

Compiler Macro: compose (&rest function-exprs)
Package

jpl-util.

Source

jpl-util.lisp.

Compiler Macro: compose-1v (&rest function-exprs)
Package

jpl-util.

Source

jpl-util.lisp.


4.1.4 Setf expanders

Setf Expander: (setf assoc*) (item alist &key key test default)
Package

jpl-util.

Source

alists-and-plists.lisp.

Reader

assoc* (function).


4.1.5 Ordinary functions

Function: a/an-number (n)

Given a non-negative integer that will be expressed as a cardinal or ordinal number in English–either by FORMAT-ORDINAL or the ~R or ~:R format directives–returns either "a" or "an", whichever is appropriate to precede the number.

Package

jpl-util.

Source

jpl-util.lisp.

Function: adjacent-pairs (sequence)

For each two adjacent pairs of elements in the given SEQUENCE, return them as a list.

If SEQUENCE has less than 2 elements, returns the empty list. Otherwise, returns (1- (LENGTH SEQUENCE)) pairs.

Package

jpl-util.

Source

jpl-util.lisp.

Function: alist->hash-table (alist &key test)
Package

jpl-util.

Source

alists-and-plists.lisp.

Function: alist->plist (alist &key key test)

Converts the given association list to a fresh property list.

KEY and TEST are applied to the CARs of the entries of ALIST for uniqueness-checking; see ITERATE-ALIST.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: all (sequence &key key)

Returns the logical-and of all the generalized booleans in the given sequence.

Package

jpl-util.

Source

jpl-util.lisp.

Function: any (sequence &key key)

Returns the logical-or of all the generalized booleans in the given sequence.

Package

jpl-util.

Source

jpl-util.lisp.

Function: assoc* (item alist &key key test default)

Like ASSOC, but returns the CDR of the matching entry, or DEFAULT if there was no match. (ASSOC* ...) is a SETF-able place.

e.g.
(defparameter *test-alist* ’())
=> *TEST-ALIST*
(assoc* ’a *test-alist*)
=> NIL
(push 1 (assoc* ’a *test-alist*))
=> (1)
(push 2 (assoc* ’a *test-alist*))
=> (2 1)
(assoc* ’a *test-alist*)
=> (2 1)
*test-alist*
=> ((A 2 1))
(setf (assoc* ’b *test-alist*) ’notalist)
=> NOTALIST
(setf (assoc* ’a *test-alist*) ’notalist)
=> NOTALIST
(assoc* ’a *test-alist*)
=> NOTALIST
*test-alist*
=> ((B . NOTALIST) (A . NOTALIST))

Package

jpl-util.

Source

alists-and-plists.lisp.

Setf expander for this function

(setf assoc*).

Function: best (set predicate &key key allow-empty)

Finds the best element in the given SET of elements (a SEQUENCE). The given PREDICATE function of two arguments must return whether the first "applicable value" represents a better item than the item represented by the second applicable value.

Elements are their own applicable value unless KEY is supplied.

When ALLOW-EMPTY, SET may be empty, in which case NIL is returned. Otherwise, an error is signalled.

This is more efficient than sorting and taking the first item from the result, and it is more general than MIN and MAX.

Package

jpl-util.

Source

jpl-util.lisp.

Function: check-bounding-indices (start-req end-req start-actual end-actual length &key sequence-desc)
Package

jpl-util.

Source

jpl-util.lisp.

Function: circular-list (list)

Returns a fresh circular list that cycles through the contents of LIST indefinitely. If LIST is empty, the result will be empty (and hence not actually circular). LIST must be a proper list; if LIST is circular, this function may not return.

Package

jpl-util.

Source

jpl-util.lisp.

Function: clear-traces! ()

Because we can’t tell whether code being traced with WITH-TRACE is still active in the system, or it’s been redefined to something else with a new trace-ID, *expr-traces-by-id* always grows. It grows only when WITH-TRACE is macroexpanded, so you should not normally need this function.

Package

jpl-util.

Source

jpl-util.lisp.

Function: coerce-boolean (b)

Normalizes the given generalized boolean to a boolean–that is, non-NIL maps to T, and NIL maps to NIL.

Package

jpl-util.

Source

jpl-util.lisp.

Function: combine-elements (sequence predicate combination-fn)

Conditionally combines the elements of sequence to form a new list. When two adjacent elements each individually pass the predicate, the combination-fn is called on both of them, in the order that they appear in the sequence, to form a new replacement item. That replacement item is subject to further combination.

Package

jpl-util.

Source

jpl-util.lisp.

Function: compose (&rest functions)

Returns the composition of a sequence of functions (designated by FUNCTIONS), yielding a new function. The new function passes all its arguments to the last given function. Each other given function gets called, from last to first, with the values of the call of its successive function. The new function returns all the values returned by the first given function.

For single-argument functions a and b, and single-value functions b and c:
(FUNCALL (COMPOSE a b c) x y z) == (a (b (c x y z)))
For any function f:
(COMPOSE f) == f
For any values x, y, and z:
COMPOSE == VALUES
(FUNCALL (COMPOSE)) => ; no value
(FUNCALL (COMPOSE) x) => x
(FUNCALL (COMPOSE) x y z) => x y z

Package

jpl-util.

Source

jpl-util.lisp.

Function: compose-1v (&rest functions)

Like COMPOSE, but restricted to (and optimized for) functions that accept only one argument. The resulting function accepts only one argument, and only the primary return value of each of the latter given functions is given to their preceding functions. The resulting function returns all the values returned by the first given function.

For single-argument functions a and b, and single-value functions b and c:
(FUNCALL (COMPOSE-1V a b c) x) == (a (b (c x)))
For any function f of one argument:
(COMPOSE f) == f
For any value x:
COMPOSE == IDENTITY
(FUNCALL (COMPOSE) x) => x

Package

jpl-util.

Source

jpl-util.lisp.

Function: cond-replace (sequence1 test-sequence new-sequence &key test key sequence1-start sequence1-end test-sequence-start test-sequence-end new-sequence-start new-sequence-end)

Tests whether SEQUENCE1 is equal to TEST-SEQUENCE according to TEST and KEY. When they are equal, destructively replaces SEQUENCE1 with the contents of NEW-SEQUENCE, and returns the modified SEQUENCE1 and T. Otherwise, returns SEQUENCE1 (unmodified) and NIL.

If SEQUENCE1 and TEST-SEQUENCE match, and if the lengths of TEST-SEQUENCE and NEW-SEQUENCE differ, SEQUENCE1 will be resized accordingly.

When SEQUENCE1 is a vector and doesn’t need to be adjusted to a different size, or is actually adjustable, or has a fill pointer which either needs to be decreased or needs to be increased within the dimensions of the vector, then the resulting sequence is guaranteed to be identical to SEQUENCE1. Otherwise, the resulting sequence may differ from SEQUENCE1 and should replace it.

SEQUENCE1, TEST-SEQUENCE, and NEW-SEQUENCE are bounded by SEQUENCE1-START and SEQUENCE1-END, by TEST-SEQUENCE-START and TEST-SEQUENCE-END, and by NEW-SEQUENCE-START and NEW-SEQUENCE-END, respectively.

Only guaranteed to be efficient on vectors.

Package

jpl-util.

Source

jpl-util.lisp.

Function: curry-left (function &rest left-args)

Partially applies each of LEFT-ARGS to FUNCTION, yielding a new function of the rest of the arguments accepted by FUNCTION.

(CURRY-LEFT f) == f ; Equivalent, but not identical. (FUNCALL (CURRY-LEFT f a)) == (FUNCALL f a)
(FUNCALL (CURRY-LEFT f a b c) d e f) == (FUNCALL f a b c d e f)

Package

jpl-util.

Source

jpl-util.lisp.

Function: curry-right (function &rest right-args)

Partially applies each of RIGHT-ARGS as the last arguments to function, in left-to-right order, yielding a new function of the rest of the arguments accepted by FUNCTION.

(CURRY-RIGHT f) == f ; Equivalent, but not identical. (FUNCALL (CURRY-RIGHT f a)) == (FUNCALL f a)
(FUNCALL (CURRY-RIGHT f a b)) == (FUNCALL f a b)
(FUNCALL (CURRY-RIGHT f d e f) a b c) == (FUNCALL f a b c d e f)

Package

jpl-util.

Source

jpl-util.lisp.

Function: decode-time-duration (duration &key subsecond-digits rounding)

Breaks down a duration of time (as a non-negative REAL number of seconds), returning days, hours, minutes, seconds, and subseconds.

The days, hours, and minutes values will be integers, while the seconds value may be fractional (the same type as DURATION) if DURATION is fractional and SUBSECOND-DIGITS is NIL; otherwise, the seconds value will be an integer.

When SUBSECOND-DIGITS is NIL, the subseconds value will be NIL and the seconds value will be of the same type as DURATION. Otherwise, SUBSECOND-DIGITS must be a non-negative integer that indicates to how many decimal places subsecond precision will be kept, and the subseconds value will be the true amount of subseconds (in [0,1), rounded according to ROUNDING and SUBSECOND-DIGITS, and expressed as a non-negative integer below (EXPT 10 SUBSECOND-DIGITS).

ROUNDING is a symbol that controls how subseconds values are rounded, and may be FLOOR, CEILING, ROUND, or TRUNCATE.

Days in which no leap seconds occur are assumed. (That is, the returned number of days assumes 24 hours in one day, which does not hold true on leap seconds days.)

Package

jpl-util.

Source

jpl-util.lisp.

Function: delete-nth! (n list)
Package

jpl-util.

Source

jpl-util.lisp.

Function: designated-class (class-designator)
Package

jpl-util.

Source

types.lisp.

Function: designated-function (extended-designator)
Package

jpl-util.

Source

types.lisp.

Function: duplicates-p (sequence &key test start end key)

Returns whether there are duplicates in the given sequence.

Package

jpl-util.

Source

jpl-util.lisp.

Function: empty? (seq)

Returns a generalized boolean indicating whether SEQ (a SEQUENCE) is empty.

Package

jpl-util.

Source

jpl-util.lisp.

Function: english-list-format-control (&optional element-format relation)

Creates a format control to format its operands as a list in English. Expects at least one operand.

Each operand will be formatted with ELEMENT-FORMAT, a format control that consumes one argument. ELEMENT-FORMAT defaults to "~A".

RELATION is a string which describes the relation between each element, such as "and" (the default for RELATION) or "or."

Package

jpl-util.

Source

jpl-util.lisp.

Function: ensure-type (value typespec &optional string)

A functional variant of CHECK-TYPE. When VALUE is of the type specified by TYPESPEC, returns VALUE. Otherwise, signals a correctable error of type TYPE-ERROR. In this case, this function will return only if the STORE-VALUE restart is invoked with a new value that matches TYPESPEC; the new value will be returned. If STORE-VALUE is invoked with a new value that doesn’t match TYPESPEC, the process continues by raising another TYPE-ERROR.

As with CHECK-TYPE, "STRING should be an English description of the type, starting with an indefinite article (’a’ or ’an’)."

Package

jpl-util.

Source

jpl-util.lisp.

Function: eof-p (stream)
Package

jpl-util.

Source

jpl-util.lisp.

Function: equivalent-hash-table-test (test)

Given a designator of a test function (one that returns a generalized boolean indicating whether its two arguments are equal), tries to find an alternative function that can be used as a hash-table test, returning two values: a semantically-equivalent function of two arguments, and a generalized boolean indicating whether the returned function is a valid hash-table test function.

The returned function will behave the same as the given designated function whenever it is given arguments which would be valid for the original function. If the returned function is given invalid arguments, it might not signal an error in situations that the original function would have.

Package

jpl-util.

Source

jpl-util.lisp.

Function: find-duplicates (sequence &key test key)

Returns all duplicates in SEQUENCE, according to the TEST and KEY. Each item that appears anywhere else in the sequence is counted.

If TEST is a standard Common Lisp function that only applies to certain types (such as numbers, strings, or characters), a substitute test may be used in order to enable fast linear-time duplicate search with a hash-table. In this case, if any element of SEQUENCE is not appropriate for TEST, and TEST would normally signal an error, the result of this function is undefined.

Package

jpl-util.

Source

jpl-util.lisp.

Function: format-ordinal (n)

Formats n to a short-hand ordinal: 1st, 2nd, etc.

Package

jpl-util.

Source

jpl-util.lisp.

Function: format-time-duration (seconds &key subsecond-digits rounding)

Breaks down the given number of seconds into day, hour, minute, and seconds components, formatting it as a string. The number of seconds may be negative.

FRAC-DIGITS is the number of digits to show after the decimal point of the seconds component (with the decimal point elided if 0). ROUNDING is a symbol that controls how subsecond precision is handled: it may be either FLOOR, CEILING, ROUND, or TRUNCATE.

Package

jpl-util.

Source

jpl-util.lisp.

Function: fractional (input denominators)

Finds the closest approximation of INPUT of the form (+ I (/ N D)), where I is an integer with the same sign as INPUT, N is a numerator of the same sign as INPUT, and D is a denominator from the non-empty list of positive integers DENOMINATORS. Returns the values I, N, and D.

For example, with DENOMINATORS equal to (2 3 4), here are
some results from example values of INPUT:

0.5 => 0 1 2
3.667 => 3 2 3
365.2425 => 365 1 4

It is conventional to express U.S. customary units with fractions, rather than decimal numbers. You can use FRACTIONAL to do this:

(defun format-inches (stream inches)
(multiple-value-bind (i n d)
(jpl-util:fractional inches ’(2 4 8 16))
;; If you’re really clever, I’m sure you can squeeze this into ;; one big FORMAT control.

;; Explicitly print minus sign, rather than use the sign of i, ;; in-case i is zero but n is negative.
(when (minusp inches)
(princ #- stream))
(princ (abs i) stream)
(unless (zerop n)
(format stream " ~D/~D" (abs n) d))
(princ " in" stream))
(values))

(format-inches t -0.07) => -0 1/16 in
(format-inches t 3.882) => 3 7/8 in
(format-inches t 11.997) => 12 in

Package

jpl-util.

Source

jpl-util.lisp.

Function: get-reasonable-real-time ()

Returns the current real time in seconds, possibly with sub-second precision. Not guaranteed to be CL universal time.

Package

jpl-util.

Source

jpl-util.lisp.

Function: get-reasonable-run-time ()

Returns the current CPU time in seconds, possibly with sub-second precision. Not guaranteed to be CL universal time.

Package

jpl-util.

Source

jpl-util.lisp.

Function: group-by-n (list n)

Groups elements in the given LIST into lists that are N elements in length. The number of elements in list must be a multiple of N.

Package

jpl-util.

Source

jpl-util.lisp.

Function: hash-table->alist (ht)
Package

jpl-util.

Source

alists-and-plists.lisp.

Function: insert-at (list n item)

Returns a new list with the given ITEM inserted into the LIST at position N.

Package

jpl-util.

Source

jpl-util.lisp.

Function: integer->twos-complement (n &optional size-multiple)

Returns the representation of N in two’s complement, as a bit-array. If SIZE-MULTIPLE is given, the length of the result will be a multiple of SIZE-MULTIPLE.

Package

jpl-util.

Source

jpl-util.lisp.

Function: integer-digit-count (n &optional radix)

Returns the number of digits required to represent the given non-negative integer in RADIX.

(integer-digit-count N RADIX) == (length (integer-digits N RADIX))

Package

jpl-util.

Source

jpl-util.lisp.

Function: integer-digits (int &optional radix)

Expresses the given non-negative integer as a fresh list of digits in the given radix. The list of digits is ordered most-significant first. When INT is 0, a list with just 0 is returned.

Package

jpl-util.

Source

jpl-util.lisp.

Function: iterate-alist (visit alist &key key test)

Iterates the entries of given association list, calling VISIT with the CAR and CDR of each entry. To match the semantics of ASSOC, only the first entry that matches (according to TEST) any given CAR (after applying KEY) is visited.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: iterate-plist (visit plist)

Iterates the properties of the given property list, calling VISIT with the indicator and value of each property. As Common Lisp property list semantics prescribe, only the first property that matches any given property indicator is visited.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: list-traces (&key stream packages)
Package

jpl-util.

Source

jpl-util.lisp.

Function: map-adjacent-pairs (result-type function sequence)

Applies FUNCTION to every adjacent pair of elements in SEQUENCE (in sequence). Returns NIL if RESULT-TYPE is NIL, otherwise returns a sequence of the values obtained by each call of FUNCTION. The type of SEQUENCE is as in MAP.

If SEQUENCE has less than 2 elements, FUNCTION is never called. Otherwise, it is called (1- (LENGTH SEQUENCE)) times.

The consequence of FUNCTION modifying SEQUENCE is undefined.

Package

jpl-util.

Source

jpl-util.lisp.

Function: map-lines (func stream)
Package

jpl-util.

Source

jpl-util.lisp.

Function: mean (sequence)

Returns the arithmetic mean of SEQUENCE. Each element of SEQUENCE must be a number.

Package

jpl-util.

Source

jpl-util.lisp.

Function: merge-alists (alists &key test test-not merge from-end initial-value)

Merges the given list of association lists.

All unique keys are collected and represented in the returned alist. For each key, the associated value will be the reduction of all of the values (in sequence) for that key found in the input alists. Values are reduced using REDUCE with the function MERGE (defaulting to #’APPEND), the list of collected values matching a key, and the values of FROM-END (defaulting to T) and INITIAL-VALUE (unspecified by default).

The order of the keys in the resulting alist is undefined.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: nsort (sequence predicate &key key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: nstable-sort (sequence predicate &key key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: nth-arg (n)

Returns a function which returns its Nth argument. Useful when composing a function with a function that returns multiple values.

Package

jpl-util.

Source

jpl-util.lisp.

Function: package< (package1 package2)

Returns a boolean indicating whether PACKAGE1 is lesser than PACKAGE2 (each are either PACKAGEs or NIL) according to the order specified below.

The order of packages is: NIL, then any PACKAGE with no name, then the KEYWORD package, then the sequence of all other packages ordered by STRING< on their names.

Package

jpl-util.

Source

order.lisp.

Function: parse-progn (body &key allow-docstring-p)

Given an implicit progn that may begin with an optional documentation string and any number of declarations (in any order), returns three values: the documentation string (or NIL if there isn’t any), a list of DECLARE expressions, and the rest of the list after the initial docstring and declarations. DECLARE expressions and a documentation string are only recognized within the initial segment; documentation strings may appear there only once.

Package

jpl-util.

Source

jpl-util.lisp.

Function: parse-sequence-type (type)

Given a type specifier which is a subtype of SEQUENCE, returns the primary sequence type (LIST or VECTOR), the element type, and the sequence length (or * for unbounded length).

If either of the latter two parameters cannot be determined, the least restricting value is used: T for element type, and * for length.

Package

jpl-util.

Source

jpl-util.lisp.

Function: parse-vector-type (type)

Given a type specifier which is a recognizable subtype of VECTOR, returns the element type and the sequence length (or * for unbounded length).

If either of these parameters cannot be determined, the least restricting value is used: T for element type, and * for length.

Package

jpl-util.

Source

jpl-util.lisp.

Function: partition-list (list &key test key)

Partitions LIST into a list of sublists according to whether adjacent elements pass the test. Adjacent elements which pass the test are placed into the same sublist.

Two adjacent elements A and B (in that order) pass the test when applying TEST to the key of A and the key of B results in a true generalized boolean value. The key of an element is produced by applying KEY to the element.

The result is a list of sublists. Every adjacent pair of elements A and B in a resulting sublist pass the test:

(... (... A B ...) ...) (funcall TEST A* B*) returns true

Every pair of elements A and B, where A ends a resulting sublist and B begins the subsequent sublist, do not pass the test:

(... (... A) (B ...) ...) (funcall TEST A* B*) returns false

The first element of the first resulting sublist is the first element of LIST. The last element of the last resulting sublist is the last element of LIST. If LIST is empty, then the resulting list of sublists is also empty.

The returned list of sublists, as well as each of its sublists, is freshly-allocated.

For set partitioning, see PARTITION-SET.

Package

jpl-util.

Source

jpl-util.lisp.

Function: partition-set (set &key test key ordered-p)

Groups elements in SET (a list) according to whether they are equal according to TEST. The result is a set of sets, represented as a fresh list of fresh lists: each contained set contains a member of SET, and every member of each such set will be equal to every other member of that same set (according to TEST).

When ORDERED-P is true, the order of the returned list of sets is the order in which the first element of each set is seen in SET. Furthermore, the order of each element in each returned set is the order in which that element was seen in SET. Preserving the order with ORDERED-P incurs a small constant-factor speed penalty.

TEST must be consistent. For any elements x y and z in SET, when x and y are equal according to TEST, and y and z are equal according to TEST, x and z must also be equal according to TEST.

The result of applying KEY each element is used for TEST.

For pairwise partitioning, see PARTITION-LIST.

Package

jpl-util.

Source

jpl-util.lisp.

Function: plist->alist (plist)

Converts the given property list to a fresh asssociation list.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: proper-list? (x)

Returns a generalized boolean indicating whether the given object (of any actual type) is a proper list. When it is, the true value returned is the length of the list.

The differences between this and LIST-LENGTH are that this function will accept objects of any type, and this function will return false for dotted lists.

Package

jpl-util.

Source

jpl-util.lisp.

Function: read-lines (stream)
Package

jpl-util.

Source

jpl-util.lisp.

Function: read-new-value ()

Prompts the user on *QUERY-IO* for a value. The value is expressed by the user as a single form, which is evaluated. The first resulting value, or NIL if there was no value, is returned as a list of one element.

Intended for :INTERACTIVE options to RESTART-CASE clauses.

Package

jpl-util.

Source

jpl-util.lisp.

Function: remove-duplicate-properties (plist)

Removes properties from the given property list that are superceded by properties with the same indicator occurring earlier in the property list.

Package

jpl-util.

Source

alists-and-plists.lisp.

Function: remove-ordered-duplicates (sequence sort-predicate &key test start end key sort-key comparison-key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: set-equal (list1 list2 &key key test)

Returns a generalized boolean indicating whether LIST1 and LIST2, when taken as unordered sets, contain exactly the same set of items (according to TEST). Duplicates either in LIST1 or in LIST2 are ignored.

KEY, when not NIL, is a function of one argument, an element from either LIST1 or LIST2. KEY is used to produce an object representative of the input element, to pass to TEST. If KEY is NIL, the elements from LIST1 and LIST2 are used directly (as if KEY is #’IDENTITY).

TEST is a function of two arguments, the KEY of an element from LIST1 and the KEY of an element from LIST2 (or vice versa), which returns a generalized boolean indicating whether the two objects should be considered to be the same.

Package

jpl-util.

Source

jpl-util.lisp.

Function: shuffle (sequence)
Package

jpl-util.

Source

jpl-util.lisp.

Function: shuffle! (sequence)

Shuffles the given sequence in-place.

Package

jpl-util.

Source

jpl-util.lisp.

Function: sort (sequence predicate &key key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: split-list! (pos list)

Destructively splits LIST into two parts: the part before position POS and the part after it. Returns the two resulting parts.

POS must be at least 0 and no greater than the length of LIST.

Package

jpl-util.

Source

jpl-util.lisp.

Function: square (x)
Package

jpl-util.

Source

jpl-util.lisp.

Function: stable-sort (sequence predicate &key key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: standard-deviation (sequence)

Returns the standard deviation of SEQUENCE. Each element of SEQUENCE must be a number.

Package

jpl-util.

Source

jpl-util.lisp.

Function: string-begin-equal (string substring &key start1 end1 start2 end2)
Package

jpl-util.

Source

jpl-util.lisp.

Function: string-begin= (string substring &key start1 end1 start2 end2)
Package

jpl-util.

Source

jpl-util.lisp.

Function: string-end-equal (string substring &key start1 end1 start2 end2)
Package

jpl-util.

Source

jpl-util.lisp.

Function: string-end= (string substring &key start1 end1 start2 end2)
Package

jpl-util.

Source

jpl-util.lisp.

Function: subseq* (sequence start &optional end)

Like subseq, but shares structure with the input sequence (where possible).

Package

jpl-util.

Source

jpl-util.lisp.

Function: subseq-displace (vector start &optional end)

Like subseq, but for vectors, returning a displaced vector which shares structure with the given vector.

Package

jpl-util.

Source

jpl-util.lisp.

Function: symbol< (symbol1 symbol2)

Returns a boolean indicating whether SYMBOL1 is lesser than SYMBOL2 (each are symbols) according to the order specified below.

A symbol is considered as the pair of its home package (or NIL if the symbol is "apparently uninterned") and its name. The two symbols are compared as their two pairs.

When the package of SYMBOL1 is less than that of SYMBOL2, SYMBOL1 is considered less than SYMBOL2, regardless of the symbol names–and vice-versa.

When the packages of SYMBOL1 and SYMBOL2 are considered equal, SYMBOL1 is less than SYMBOL2 iff the name of SYMBOL1 is STRING< that of SYMBOL2.

Packages are compared with PACKAGE<.

Package

jpl-util.

Source

order.lisp.

Function: test-order-pred (predicate elements)

Tests PREDICATE, an order predicate, with the given sequence of elements. Signals an error if an inconsistency is found. Otherwise, returns a vector of the items sorted in ascending order.

An order predicate is a function of two arguments which returns a generalized boolean indicating whether the first argument is less than the second. It’s the kind of function you would give to SORT.

Package

jpl-util.

Source

order.lisp.

Function: twos-complement->integer (bit-vector)

Returns the integer represented in two’s complement within BIT-VECTOR.

Package

jpl-util.

Source

jpl-util.lisp.

Function: unique-pairs (list &optional predicate)

Returns the set of each possible ordered pair of elements in LIST. Each ordered pair is represented as a list. The returned set is represented as a list.

When PREDICATE is given and not NIL, it must be function. PREDICATE is applied to each pair of elements to filter them from the result set; pairs for which PREDICATE returns false are omitted.

Package

jpl-util.

Source

jpl-util.lisp.

Function: vector-delete (vector index &optional nil-p)

Destructively removes the element specified at INDEX from VECTOR in constant time. VECTOR must have a fill pointer; it is updated. INDEX must be less than the length of VECTOR (according to its fill pointer).

When NIL-P is true or not given, elements made to be
unreferenced (outside the active region denoted by the fill-pointer) are overwritten with NIL, to prevent holding onto potentially big objects, which would keep them from garbage collection indefinitely. When NIL-P is false, the set of elements within VECTOR will remain the same–only reordering and fill-pointer manipulation will occur. Generally, NIL-P should be false only when VECTOR shares structure with another vector (via displacement) or its fill-pointer will later be artificially manipulated in order to recover deleted objects.

The order of elements within VECTOR should be mostly insignificant, such as when VECTOR represents a set of objects, because elements are reordered. Specifically, the last element of VECTOR and the element at INDEX are swapped. Therefore, after returning, the positions of the element at INDEX and the element just past the fill-pointer may be different (with the exception that the element just past the fill-pointer will be NIL when NIL-P is true); other elements will retain their position. (This apparent implementation detail is explicitly specified to allow for specific algorithms and bookkeeping that depends on the indices of VECTOR.)

Package

jpl-util.

Source

vector-delete.lisp.

Function: vector-delete-range (vector &key start end)

Destructively removes a subsequence of elements, specified by START and END, from VECTOR, in time linear proportional to the length of the subsequence. VECTOR must have a fill pointer; it is updated. START and END must be bounding indices with the length of VECTOR (according to its fill pointer).

The order of elements within VECTOR may be changed starting with START and up to the end of the VECTOR. Therefore, this function is best used for situations where a vector is considered to be a set, and the order of its elements doesn’t matter.

Package

jpl-util.

Source

vector-delete.lisp.

Function: with-extent-hooks% (enter-fn return-fn non-local-exit-fn main-fn)

Function-based variant of WITH-EXTENT-HOOKS; see its documentation.

ENTER-FN must be a function of no arguments. RETURN-FN must be a function that can accept one argument for each value returned by MAIN-FN. NON-LOCAL-EXIT-FN must be a function of no arguments. MAIN-FN must be a function of no arguments.

Package

jpl-util.

Source

jpl-util.lisp.

Function: zip (&rest lists)
Package

jpl-util.

Source

jpl-util.lisp.

Function: zip* (lists &key pad)

Combines the elements of each list of LISTS, returning a fresh list where the element at position n is a fresh list of corresponding elements from the input lists, each at position n. To put it another way, if you think of the input lists as a matrix, this returns the transpose of the matrix.

If PAD is specified and the lengths of the input lists are not equal, then the lists will be implicitly padded with PAD at the end, as if all the lists were of the same length as the longest list.

Package

jpl-util.

Source

jpl-util.lisp.


4.1.6 Generic functions

Generic Function: copy-object (obj)

Recursively copies an object. The output is
guaranteed to not share structure with the input. Patterns of shared structure may not be replicated in the output. If the input has reference cycles, this function may not return or signal a condition.

Package

jpl-util.

Source

jpl-util.lisp.

Methods
Method: copy-object ((obj character))
Method: copy-object ((obj symbol))
Method: copy-object ((obj null))
Method: copy-object ((obj number))
Method: copy-object ((seq sequence))
Method: copy-object ((cons-obj cons))
Generic Reader: subtype-error-expected-supertype (condition)
Package

jpl-util.

Methods
Reader Method: subtype-error-expected-supertype ((condition subtype-error))
Source

subtypecase.lisp.

Target Slot

expected-supertype.

Generic Reader: subtype-error-type (condition)
Package

jpl-util.

Methods
Reader Method: subtype-error-type ((condition subtype-error))
Source

subtypecase.lisp.

Target Slot

type.


4.1.7 Conditions

Condition: subtype-error

TYPE is not a subtype of EXPECTED-SUPERTYPE.

Package

jpl-util.

Source

subtypecase.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: type
Package

common-lisp.

Initform

(quote (error "must supply :type."))

Initargs

:type

Readers

subtype-error-type.

Writers

This slot is read-only.

Slot: expected-supertype
Initform

(quote (error "must supply :expected-supertype."))

Initargs

:expected-supertype

Readers

subtype-error-expected-supertype.

Writers

This slot is read-only.


4.1.8 Types

Type: array-dimension ()
Package

jpl-util.

Source

types.lisp.

Type: array-index ()
Package

jpl-util.

Source

types.lisp.

Type: class-designator ()
Package

jpl-util.

Source

types.lisp.

Type: extended-function-designator ()
Package

jpl-util.

Source

types.lisp.

Type: format-control ()
Package

jpl-util.

Source

types.lisp.

Type: function-designator ()
Package

jpl-util.

Source

types.lisp.

Type: function-name ()
Package

jpl-util.

Source

types.lisp.

Type: pathname-designator ()
Package

jpl-util.

Source

types.lisp.

Type: subsecond-universal-time ()
Package

jpl-util.

Source

types.lisp.

Type: universal-time ()
Package

jpl-util.

Source

types.lisp.


4.2 Internals


4.2.1 Special variables

Special Variable: *expr-traces-by-expr*
Package

jpl-util.

Source

jpl-util.lisp.

Special Variable: *expr-traces-by-id*
Package

jpl-util.

Source

jpl-util.lisp.

Special Variable: *verbosity-depth*

The number of containing WITH-VERBOSITY forms that specify verbosity to be enabled.

Package

jpl-util.

Source

jpl-util.lisp.


4.2.2 Macros

Macro: handler-case/no-unwind (form &rest clauses)

Like HANDLER-CASE, but does not unwind the stack before executing an error-handling clause.

Package

jpl-util.

Source

jpl-util.lisp.

Macro: push-append% (place list)
Package

jpl-util.

Source

jpl-util.lisp.

Macro: push-nconc% (place list)
Package

jpl-util.

Source

jpl-util.lisp.


4.2.3 Ordinary functions

Function: expr-trace-expression-format (expr-trace)
Package

jpl-util.

Source

jpl-util.lisp.

Function: find-duplicates-in-list (list test key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: find-duplicates-in-vector (vector test key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: find-duplicates-with-hash-table (sequence test key)
Package

jpl-util.

Source

jpl-util.lisp.

Function: list-extract!-helper (list predicate mapping-p)
Package

jpl-util.

Source

jpl-util.lisp.

Function: option-clause-list->plist (clauses)
Package

jpl-util.

Source

option-clause.lisp.

Function: register-trace (expression &optional id)
Package

jpl-util.

Source

jpl-util.lisp.

Function: swapped-append (l2 l1)
Package

jpl-util.

Source

jpl-util.lisp.

Function: swapped-nconc (l2 l1)
Package

jpl-util.

Source

jpl-util.lisp.

Function: test-vector-delete (vector sub-start sub-end expected)
Package

jpl-util.

Source

vector-delete.lisp.

Function: test-vector-delete-functions (&key count length)
Package

jpl-util.

Source

vector-delete.lisp.

Function: test-vector-delete-range (vector sub-start sub-end expected)
Package

jpl-util.

Source

vector-delete.lisp.

Function: vector-equal (v1 v2)
Package

jpl-util.

Source

vector-delete.lisp.

Function: verbosely% (function control-string &rest format-arguments)
Package

jpl-util.

Source

jpl-util.lisp.

Function: with-verbosity% (function &optional verbose)
Package

jpl-util.

Source

jpl-util.lisp.


4.2.4 Generic functions

Generic Reader: expression (object)
Package

jpl-util.

Methods
Reader Method: expression ((expr-trace expr-trace))

automatically generated reader method

Source

jpl-util.lisp.

Target Slot

expression.

Generic Writer: (setf expression) (object)
Package

jpl-util.

Methods
Writer Method: (setf expression) ((expr-trace expr-trace))

automatically generated writer method

Source

jpl-util.lisp.

Target Slot

expression.

Generic Reader: home-package (object)
Package

jpl-util.

Methods
Reader Method: home-package ((expr-trace expr-trace))

automatically generated reader method

Source

jpl-util.lisp.

Target Slot

home-package.

Generic Reader: id (object)
Package

jpl-util.

Methods
Reader Method: id ((expr-trace expr-trace))

automatically generated reader method

Source

jpl-util.lisp.

Target Slot

id.


4.2.5 Classes

Class: expr-trace
Package

jpl-util.

Source

jpl-util.lisp.

Direct methods
Direct slots
Slot: id
Type

integer

Initform

(error "must supply id.")

Initargs

:id

Readers

id.

Writers

This slot is read-only.

Slot: expression
Initform

(error "must supply expression.")

Initargs

:expression

Readers

expression.

Writers

(setf expression).

Slot: home-package
Type

package

Initform

(error "must supply home-package")

Initargs

:home-package

Readers

home-package.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (   1  
A   B   C   D   E   F   G   H   I   L   M   N   O   P   R   S   T   U   V   W   X   Z  
Index Entry  Section

(
(setf assoc*): Public setf expanders
(setf expression): Private generic functions
(setf expression): Private generic functions

1
1or: Public macros

A
a/an-number: Public ordinary functions
accumulate-to-dynamic-vector: Public macros
accumulate-to-hash-table: Public macros
accumulate-to-list: Public macros
accumulate-to-vector: Public macros
adjacent-pairs: Public ordinary functions
alist->hash-table: Public ordinary functions
alist->plist: Public ordinary functions
all: Public ordinary functions
any: Public ordinary functions
assoc*: Public ordinary functions

B
best: Public ordinary functions

C
check-bounding-indices: Public ordinary functions
check-type*: Public macros
circular-list: Public ordinary functions
clear-traces!: Public ordinary functions
coerce-boolean: Public ordinary functions
combine-elements: Public ordinary functions
Compiler Macro, compose: Public compiler macros
Compiler Macro, compose-1v: Public compiler macros
compose: Public compiler macros
compose: Public ordinary functions
compose-1v: Public compiler macros
compose-1v: Public ordinary functions
composite-lesser?: Public macros
cond-replace: Public ordinary functions
copy-object: Public generic functions
copy-object: Public generic functions
copy-object: Public generic functions
copy-object: Public generic functions
copy-object: Public generic functions
copy-object: Public generic functions
copy-object: Public generic functions
csubtypecase: Public macros
curry-left: Public ordinary functions
curry-right: Public ordinary functions

D
decode-time-duration: Public ordinary functions
defclass*: Public macros
defvar-unbound: Public macros
delete-nth!: Public ordinary functions
designated-class: Public ordinary functions
designated-function: Public ordinary functions
doseq: Public macros
duplicates-p: Public ordinary functions

E
empty?: Public ordinary functions
english-list-format-control: Public ordinary functions
ensure-type: Public ordinary functions
eof-p: Public ordinary functions
equivalent-hash-table-test: Public ordinary functions
esubtypecase: Public macros
expr-trace-expression-format: Private ordinary functions
expression: Private generic functions
expression: Private generic functions

F
find-duplicates: Public ordinary functions
find-duplicates-in-list: Private ordinary functions
find-duplicates-in-vector: Private ordinary functions
find-duplicates-with-hash-table: Private ordinary functions
format-ordinal: Public ordinary functions
format-time-duration: Public ordinary functions
fractional: Public ordinary functions
Function, a/an-number: Public ordinary functions
Function, adjacent-pairs: Public ordinary functions
Function, alist->hash-table: Public ordinary functions
Function, alist->plist: Public ordinary functions
Function, all: Public ordinary functions
Function, any: Public ordinary functions
Function, assoc*: Public ordinary functions
Function, best: Public ordinary functions
Function, check-bounding-indices: Public ordinary functions
Function, circular-list: Public ordinary functions
Function, clear-traces!: Public ordinary functions
Function, coerce-boolean: Public ordinary functions
Function, combine-elements: Public ordinary functions
Function, compose: Public ordinary functions
Function, compose-1v: Public ordinary functions
Function, cond-replace: Public ordinary functions
Function, curry-left: Public ordinary functions
Function, curry-right: Public ordinary functions
Function, decode-time-duration: Public ordinary functions
Function, delete-nth!: Public ordinary functions
Function, designated-class: Public ordinary functions
Function, designated-function: Public ordinary functions
Function, duplicates-p: Public ordinary functions
Function, empty?: Public ordinary functions
Function, english-list-format-control: Public ordinary functions
Function, ensure-type: Public ordinary functions
Function, eof-p: Public ordinary functions
Function, equivalent-hash-table-test: Public ordinary functions
Function, expr-trace-expression-format: Private ordinary functions
Function, find-duplicates: Public ordinary functions
Function, find-duplicates-in-list: Private ordinary functions
Function, find-duplicates-in-vector: Private ordinary functions
Function, find-duplicates-with-hash-table: Private ordinary functions
Function, format-ordinal: Public ordinary functions
Function, format-time-duration: Public ordinary functions
Function, fractional: Public ordinary functions
Function, get-reasonable-real-time: Public ordinary functions
Function, get-reasonable-run-time: Public ordinary functions
Function, group-by-n: Public ordinary functions
Function, hash-table->alist: Public ordinary functions
Function, insert-at: Public ordinary functions
Function, integer->twos-complement: Public ordinary functions
Function, integer-digit-count: Public ordinary functions
Function, integer-digits: Public ordinary functions
Function, iterate-alist: Public ordinary functions
Function, iterate-plist: Public ordinary functions
Function, list-extract!-helper: Private ordinary functions
Function, list-traces: Public ordinary functions
Function, map-adjacent-pairs: Public ordinary functions
Function, map-lines: Public ordinary functions
Function, mean: Public ordinary functions
Function, merge-alists: Public ordinary functions
Function, nsort: Public ordinary functions
Function, nstable-sort: Public ordinary functions
Function, nth-arg: Public ordinary functions
Function, option-clause-list->plist: Private ordinary functions
Function, package<: Public ordinary functions
Function, parse-progn: Public ordinary functions
Function, parse-sequence-type: Public ordinary functions
Function, parse-vector-type: Public ordinary functions
Function, partition-list: Public ordinary functions
Function, partition-set: Public ordinary functions
Function, plist->alist: Public ordinary functions
Function, proper-list?: Public ordinary functions
Function, read-lines: Public ordinary functions
Function, read-new-value: Public ordinary functions
Function, register-trace: Private ordinary functions
Function, remove-duplicate-properties: Public ordinary functions
Function, remove-ordered-duplicates: Public ordinary functions
Function, set-equal: Public ordinary functions
Function, shuffle: Public ordinary functions
Function, shuffle!: Public ordinary functions
Function, sort: Public ordinary functions
Function, split-list!: Public ordinary functions
Function, square: Public ordinary functions
Function, stable-sort: Public ordinary functions
Function, standard-deviation: Public ordinary functions
Function, string-begin-equal: Public ordinary functions
Function, string-begin=: Public ordinary functions
Function, string-end-equal: Public ordinary functions
Function, string-end=: Public ordinary functions
Function, subseq*: Public ordinary functions
Function, subseq-displace: Public ordinary functions
Function, swapped-append: Private ordinary functions
Function, swapped-nconc: Private ordinary functions
Function, symbol<: Public ordinary functions
Function, test-order-pred: Public ordinary functions
Function, test-vector-delete: Private ordinary functions
Function, test-vector-delete-functions: Private ordinary functions
Function, test-vector-delete-range: Private ordinary functions
Function, twos-complement->integer: Public ordinary functions
Function, unique-pairs: Public ordinary functions
Function, vector-delete: Public ordinary functions
Function, vector-delete-range: Public ordinary functions
Function, vector-equal: Private ordinary functions
Function, verbosely%: Private ordinary functions
Function, with-extent-hooks%: Public ordinary functions
Function, with-verbosity%: Private ordinary functions
Function, zip: Public ordinary functions
Function, zip*: Public ordinary functions

G
Generic Function, (setf expression): Private generic functions
Generic Function, copy-object: Public generic functions
Generic Function, expression: Private generic functions
Generic Function, home-package: Private generic functions
Generic Function, id: Private generic functions
Generic Function, subtype-error-expected-supertype: Public generic functions
Generic Function, subtype-error-type: Public generic functions
get-reasonable-real-time: Public ordinary functions
get-reasonable-run-time: Public ordinary functions
group-by-n: Public ordinary functions

H
handler-case/no-unwind: Private macros
hash-table->alist: Public ordinary functions
home-package: Private generic functions
home-package: Private generic functions

I
id: Private generic functions
id: Private generic functions
insert-at: Public ordinary functions
integer->twos-complement: Public ordinary functions
integer-digit-count: Public ordinary functions
integer-digits: Public ordinary functions
iterate-alist: Public ordinary functions
iterate-plist: Public ordinary functions

L
lambda*: Public macros
lesser?: Public macros
list-extract!: Public macros
list-extract!-helper: Private ordinary functions
list-traces: Public ordinary functions

M
Macro, 1or: Public macros
Macro, accumulate-to-dynamic-vector: Public macros
Macro, accumulate-to-hash-table: Public macros
Macro, accumulate-to-list: Public macros
Macro, accumulate-to-vector: Public macros
Macro, check-type*: Public macros
Macro, composite-lesser?: Public macros
Macro, csubtypecase: Public macros
Macro, defclass*: Public macros
Macro, defvar-unbound: Public macros
Macro, doseq: Public macros
Macro, esubtypecase: Public macros
Macro, handler-case/no-unwind: Private macros
Macro, lambda*: Public macros
Macro, lesser?: Public macros
Macro, list-extract!: Public macros
Macro, option-clause-bind: Public macros
Macro, push-append: Public macros
Macro, push-append%: Private macros
Macro, push-nconc: Public macros
Macro, push-nconc%: Private macros
Macro, subtypecase: Public macros
Macro, verbosely: Public macros
Macro, with-accessors*: Public macros
Macro, with-extent-hooks: Public macros
Macro, with-gensyms: Public macros
Macro, with-list-iterator: Public macros
Macro, with-range-iterator: Public macros
Macro, with-safe-alloc: Public macros
Macro, with-sequence-iterator: Public macros
Macro, with-trace: Public macros
Macro, with-vector-iterator: Public macros
Macro, with-verbosity: Public macros
Macro, xor: Public macros
map-adjacent-pairs: Public ordinary functions
map-lines: Public ordinary functions
mean: Public ordinary functions
merge-alists: Public ordinary functions
Method, (setf expression): Private generic functions
Method, copy-object: Public generic functions
Method, copy-object: Public generic functions
Method, copy-object: Public generic functions
Method, copy-object: Public generic functions
Method, copy-object: Public generic functions
Method, copy-object: Public generic functions
Method, expression: Private generic functions
Method, home-package: Private generic functions
Method, id: Private generic functions
Method, subtype-error-expected-supertype: Public generic functions
Method, subtype-error-type: Public generic functions

N
nsort: Public ordinary functions
nstable-sort: Public ordinary functions
nth-arg: Public ordinary functions

O
option-clause-bind: Public macros
option-clause-list->plist: Private ordinary functions

P
package<: Public ordinary functions
parse-progn: Public ordinary functions
parse-sequence-type: Public ordinary functions
parse-vector-type: Public ordinary functions
partition-list: Public ordinary functions
partition-set: Public ordinary functions
plist->alist: Public ordinary functions
proper-list?: Public ordinary functions
push-append: Public macros
push-append%: Private macros
push-nconc: Public macros
push-nconc%: Private macros

R
read-lines: Public ordinary functions
read-new-value: Public ordinary functions
register-trace: Private ordinary functions
remove-duplicate-properties: Public ordinary functions
remove-ordered-duplicates: Public ordinary functions

S
set-equal: Public ordinary functions
Setf Expander, (setf assoc*): Public setf expanders
shuffle: Public ordinary functions
shuffle!: Public ordinary functions
sort: Public ordinary functions
split-list!: Public ordinary functions
square: Public ordinary functions
stable-sort: Public ordinary functions
standard-deviation: Public ordinary functions
string-begin-equal: Public ordinary functions
string-begin=: Public ordinary functions
string-end-equal: Public ordinary functions
string-end=: Public ordinary functions
subseq*: Public ordinary functions
subseq-displace: Public ordinary functions
subtype-error-expected-supertype: Public generic functions
subtype-error-expected-supertype: Public generic functions
subtype-error-type: Public generic functions
subtype-error-type: Public generic functions
subtypecase: Public macros
swapped-append: Private ordinary functions
swapped-nconc: Private ordinary functions
symbol<: Public ordinary functions

T
test-order-pred: Public ordinary functions
test-vector-delete: Private ordinary functions
test-vector-delete-functions: Private ordinary functions
test-vector-delete-range: Private ordinary functions
twos-complement->integer: Public ordinary functions

U
unique-pairs: Public ordinary functions

V
vector-delete: Public ordinary functions
vector-delete-range: Public ordinary functions
vector-equal: Private ordinary functions
verbosely: Public macros
verbosely%: Private ordinary functions

W
with-accessors*: Public macros
with-extent-hooks: Public macros
with-extent-hooks%: Public ordinary functions
with-gensyms: Public macros
with-list-iterator: Public macros
with-range-iterator: Public macros
with-safe-alloc: Public macros
with-sequence-iterator: Public macros
with-trace: Public macros
with-vector-iterator: Public macros
with-verbosity: Public macros
with-verbosity%: Private ordinary functions

X
xor: Public macros

Z
zip: Public ordinary functions
zip*: Public ordinary functions


A.4 Data types

Jump to:   A   C   D   E   F   G   I   J   O   P   S   T   U   V  
Index Entry  Section

A
accumulators.lisp: The jpl-util/accumulators․lisp file
alists-and-plists.lisp: The jpl-util/alists-and-plists․lisp file
array-dimension: Public types
array-index: Public types

C
Class, expr-trace: Private classes
class-designator: Public types
Condition, subtype-error: Public conditions

D
defclass-star.lisp: The jpl-util/defclass-star․lisp file

E
expr-trace: Private classes
extended-function-designator: Public types

F
File, accumulators.lisp: The jpl-util/accumulators․lisp file
File, alists-and-plists.lisp: The jpl-util/alists-and-plists․lisp file
File, defclass-star.lisp: The jpl-util/defclass-star․lisp file
File, gensyms.lisp: The jpl-util/gensyms․lisp file
File, iterators.lisp: The jpl-util/iterators․lisp file
File, jpl-util.asd: The jpl-util/jpl-util․asd file
File, jpl-util.lisp: The jpl-util/jpl-util․lisp file
File, option-clause.lisp: The jpl-util/option-clause․lisp file
File, order.lisp: The jpl-util/order․lisp file
File, package.lisp: The jpl-util/package․lisp file
File, subtypecase.lisp: The jpl-util/subtypecase․lisp file
File, types.lisp: The jpl-util/types․lisp file
File, vector-delete.lisp: The jpl-util/vector-delete․lisp file
format-control: Public types
function-designator: Public types
function-name: Public types

G
gensyms.lisp: The jpl-util/gensyms․lisp file

I
iterators.lisp: The jpl-util/iterators․lisp file

J
jpl-util: The jpl-util system
jpl-util: The jpl-util package
jpl-util.asd: The jpl-util/jpl-util․asd file
jpl-util.lisp: The jpl-util/jpl-util․lisp file

O
option-clause.lisp: The jpl-util/option-clause․lisp file
order.lisp: The jpl-util/order․lisp file

P
Package, jpl-util: The jpl-util package
package.lisp: The jpl-util/package․lisp file
pathname-designator: Public types

S
subsecond-universal-time: Public types
subtype-error: Public conditions
subtypecase.lisp: The jpl-util/subtypecase․lisp file
System, jpl-util: The jpl-util system

T
Type, array-dimension: Public types
Type, array-index: Public types
Type, class-designator: Public types
Type, extended-function-designator: Public types
Type, format-control: Public types
Type, function-designator: Public types
Type, function-name: Public types
Type, pathname-designator: Public types
Type, subsecond-universal-time: Public types
Type, universal-time: Public types
types.lisp: The jpl-util/types․lisp file

U
universal-time: Public types

V
vector-delete.lisp: The jpl-util/vector-delete․lisp file