The agutil Reference Manual

This is the agutil Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 14:31:22 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 agutil

A collection of utility functions not found in other utility libraries.

Author

Alexander Gutev

License

MIT

Version

0.0.1

Dependencies
  • alexandria (system).
  • optima (system).
Source

agutil.asd.

Child Components

3 Files

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


3.1 Lisp


3.1.1 agutil/agutil.asd

Source

agutil.asd.

Parent Component

agutil (system).

ASDF Systems

agutil.


3.1.2 agutil/package.lisp

Source

agutil.asd.

Parent Component

agutil (system).

Packages

agutil.


3.1.3 agutil/let-over-lambda.lisp

Dependency

package.lisp (file).

Source

agutil.asd.

Parent Component

agutil (system).

Internals

3.1.4 agutil/functions.lisp

Dependency

let-over-lambda.lisp (file).

Source

agutil.asd.

Parent Component

agutil (system).

Public Interface

3.1.5 agutil/macros.lisp

Dependency

functions.lisp (file).

Source

agutil.asd.

Parent Component

agutil (system).

Public Interface

4 Packages

Packages are listed by definition order.


4.1 agutil

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
  • optima.
Public Interface
Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: define-merged-package (name &rest packages)

Convenience macro which defines a merged package using MERGE-PACKAGES. NAME (not evaluated) is the name of the new package and PACKAGES (not evaluated) is the list of packages of which the external symbols are imported in package NAME.

Package

agutil.

Source

functions.lisp.

Macro: dohash ((key value hash &optional result) &body body)

Iterates over each element of HASH with the key bound to KEY and the value bound to VALUE. BODY is evaluated on each iteration in an implicit PROGN.

Package

agutil.

Source

macros.lisp.

Macro: let-if ((&rest bindings) condition &body body)

Binds variables to different values computed by different init-forms based on whether CONDITION evaluates to true or false. BINDINGS is a list of bindings where the first element is the variable symbol the second element is the init-form to evaluated if CONDITION evaluates to true, the second element is the init-form to evaluate if CONDITION evaluates to false.

Package

agutil.

Source

macros.lisp.

Macro: match-state (arg &body states)

Implements an FSM (Finite State Machine) where each state may specify a pattern (in the form accepted by the trivia pattern matcher) and a list of from states, when the argument matches the pattern of a particular state and the current state is in the state’s from states list, the FSM transitions to that state.

Each element in STATES is a list of the following form: (STATE PATTERN [:FROM STATES] . BODY) where STATE is a symbol identifying the state, PATTERN is the pattern to be matched, and STATES is the optional list of from states (it and the :FROM keyword may be excluded). if there is only one state it does not have to be in a list. If a state specifies no from states, it is as if all states, in the MATCH-STATE form, are specified as from states.

When a state becomes the current state the forms in its BODY are executed, in which the machine may either transition to the next state using the lexically defined function (NEXT NEW-ARG) where NEW-ARG is the new argument to be matched against the patterns. If NEXT is never called in body the return value of the last form in BODY becomes the return value of the MATCH-STATE form.

The initial argument is given by evaluating the form ARG. The initial state may be optionally specified, when the first element of STATES is :START the second element is taken as the form to be evaluated to produce the start state, otherwise the start state defaults to :START. Patterns are matched in the order given, the first state whose pattern matches (both the argument pattern and FROM list) becomes the current state.

Package

agutil.

Source

macros.lisp.

Macro: nlet (name (&rest bindings) &body body)
Package

agutil.

Source

macros.lisp.

Macro: update-let ((&rest bindings) &body body)

Establishes bindings to variables, which are visible to the forms in BODY, however each binding also has an update form, the result of which is assigned to the variable in the environment of the UPDATE-LET form itself.

Each element of BINDINGS is a list of the form (VAR INIT-FORM UPDATE-FORM) where var is the variable symbol, INIT-FORM is the form of which the result is bound to VAR. This binding is visible to the forms in BODY. UPDATE-FORM is a form of which the result is assigned to VAR affecting the binding which is visible in the environment of the UPDATE-LET form itself, and not the binding which is visible in BODY. Each UPDATE-FORM is executed after the last form in BODY with the symbol OLD being bound to the value of the corresponding variable in the environment of the UPDATE-LET form.

The value of the last form in BODY is returned.

Package

agutil.

Source

macros.lisp.

Macro: with-struct-slots (conc-name (&rest slots) object &body body)

Same as WITH-SLOTS however for structures defined by
DEFSTRUCT. CONC-NAME is the symbol, passed to the CONC-NAME option to DEFSTRUCT, which is prepended to each symbol in SLOTS to generate the name of the accessor function for the slot.

Package

agutil.

Source

macros.lisp.


5.1.2 Ordinary functions

Function: dequeue (queue)

Removes and returns the element at the tail of QUEUE. NIL if the queue is empty. QUEUE is modified.

Package

agutil.

Source

functions.lisp.

Function: enqueue (elem queue)

Adds ELEM to the head of QUEUE. QUEUE is modified.

Package

agutil.

Source

functions.lisp.

Function: enqueue-list (elems queue)

Adds each element in the list ELEMS to the head of the queue QUEUE. QUEUE is modified.

Package

agutil.

Source

functions.lisp.

Function: gensyms (syms &key key)

Returns a list of unique symbols, generated by GENSYM. The SYMBOL-NAME of each element in SYMS is used as a prefix of the corresponding generated symbol. If KEY is provided the SYMBOL-NAME of the result returned by calling KEY with each element in SYMS is used as the prefix.

Package

agutil.

Source

functions.lisp.

Function: make-queue (&rest elems)

Creates a FIFO queue with initial elements ELEMS.

Package

agutil.

Source

functions.lisp.

Function: merge-packages (new-package-name &rest packages)

Creates a new package with name NEW-PACKAGE-NAME, if it does not already exist, into which all external symbols in each package in PACKAGES are imported, by SHADOWING-IMPORT. If the package is a list with :INTERNAL as the first element, the internal symbols of the package (with the name as the second element) are imported instead.

The external symbols of each package in PACKAGES are imported in the order in which the package appears in the list, thus symbols imported from packages towards the end of the PACKAGES list will shadow symbols imported from packages at the beginning of the list.

Package

agutil.

Source

functions.lisp.

Function: queue->list (queue)

Returns a list of the elements in QUEUE.

Package

agutil.

Source

functions.lisp.

Function: queue-empty? (queue)

Returns true if QUEUE is empty.

Package

agutil.

Source

functions.lisp.

Function: repeat-function (fn n)

Returns a list of N items obtained by calling the function FN N times.

Package

agutil.

Source

functions.lisp.


5.2 Internals


5.2.1 Macros

Macro: defmacro! (name args &rest body)
Package

agutil.

Source

let-over-lambda.lisp.

Macro: defmacro/g! (name args &rest body)
Package

agutil.

Source

let-over-lambda.lisp.

Macro: defun! (name args &body body)
Package

agutil.

Source

let-over-lambda.lisp.


5.2.2 Ordinary functions

Function: g!-symbol-p (s)
Package

agutil.

Source

let-over-lambda.lisp.

Function: group (source n)
Package

agutil.

Source

let-over-lambda.lisp.

Function: lol-flatten (x)
Package

agutil.

Source

let-over-lambda.lisp.

Function: mkstr (&rest args)
Package

agutil.

Source

let-over-lambda.lisp.

Function: o!-symbol-p (s)
Package

agutil.

Source

let-over-lambda.lisp.

Function: o!-symbol-to-g!-symbol (s)
Package

agutil.

Source

let-over-lambda.lisp.

Function: symb (&rest args)
Package

agutil.

Source

let-over-lambda.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   D   E   F   G   L   M   N   O   Q   R   S   U   W  
Index Entry  Section

D
define-merged-package: Public macros
defmacro!: Private macros
defmacro/g!: Private macros
defun!: Private macros
dequeue: Public ordinary functions
dohash: Public macros

E
enqueue: Public ordinary functions
enqueue-list: Public ordinary functions

F
Function, dequeue: Public ordinary functions
Function, enqueue: Public ordinary functions
Function, enqueue-list: Public ordinary functions
Function, g!-symbol-p: Private ordinary functions
Function, gensyms: Public ordinary functions
Function, group: Private ordinary functions
Function, lol-flatten: Private ordinary functions
Function, make-queue: Public ordinary functions
Function, merge-packages: Public ordinary functions
Function, mkstr: Private ordinary functions
Function, o!-symbol-p: Private ordinary functions
Function, o!-symbol-to-g!-symbol: Private ordinary functions
Function, queue->list: Public ordinary functions
Function, queue-empty?: Public ordinary functions
Function, repeat-function: Public ordinary functions
Function, symb: Private ordinary functions

G
g!-symbol-p: Private ordinary functions
gensyms: Public ordinary functions
group: Private ordinary functions

L
let-if: Public macros
lol-flatten: Private ordinary functions

M
Macro, define-merged-package: Public macros
Macro, defmacro!: Private macros
Macro, defmacro/g!: Private macros
Macro, defun!: Private macros
Macro, dohash: Public macros
Macro, let-if: Public macros
Macro, match-state: Public macros
Macro, nlet: Public macros
Macro, update-let: Public macros
Macro, with-struct-slots: Public macros
make-queue: Public ordinary functions
match-state: Public macros
merge-packages: Public ordinary functions
mkstr: Private ordinary functions

N
nlet: Public macros

O
o!-symbol-p: Private ordinary functions
o!-symbol-to-g!-symbol: Private ordinary functions

Q
queue->list: Public ordinary functions
queue-empty?: Public ordinary functions

R
repeat-function: Public ordinary functions

S
symb: Private ordinary functions

U
update-let: Public macros

W
with-struct-slots: Public macros


A.3 Variables