The agutil Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The agutil Reference Manual

This is the agutil Reference Manual, version 0.0.1, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Apr 08 12:53:22 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

AGUTIL

A collection of Common Lisp utility functions and macros not found (to the best of my knowledge) in other utility packages.

Macro Writing

Function: GENSYMS &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.

Packages

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. 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.

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.

Functional Programming

Function REPEAT-FUNCTION FN N

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

Utility Macros

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.

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.

FIFO Queue

Function: MAKE-QUEUE &REST ELEMS

Creates a FIFO queue with initial elements ELEMS.

Function: QUEUE-EMPTY? QUEUE

Returns true if QUEUE is empty.

Function: ENQUEUE ELEM QUEUE

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

Function: DEQUEUE QUEUE

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

Function: ENQUEUE-LIST ELEMS QUEUE

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

Function: QUEUE->LIST QUEUE

Returns a list of the elements in QUEUE.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 agutil

Author

Alexander Gutev

License

MIT

Description

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

Version

0.0.1

Dependencies
Source

agutil.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 agutil.asd

Location

agutil.asd

Systems

agutil (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 agutil/package.lisp

Parent

agutil (system)

Location

package.lisp

Packages

agutil


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 agutil/let-over-lambda.lisp

Dependency

package.lisp (file)

Parent

agutil (system)

Location

let-over-lambda.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 agutil/functions.lisp

Dependency

let-over-lambda.lisp (file)

Parent

agutil (system)

Location

functions.lisp

Exported Definitions

Previous: , Up: Lisp files   [Contents][Index]

3.1.5 agutil/macros.lisp

Dependency

functions.lisp (file)

Parent

agutil (system)

Location

macros.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 agutil

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

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 (file)

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 (file)

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 (file)

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 (file)

Macro: nlet NAME (&rest BINDINGS) &body BODY
Package

agutil

Source

macros.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 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 (file)

Function: enqueue ELEM QUEUE

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

Package

agutil

Source

functions.lisp (file)

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 (file)

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 (file)

Function: make-queue &rest ELEMS

Creates a FIFO queue with initial elements ELEMS.

Package

agutil

Source

functions.lisp (file)

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 (file)

Function: queue->list QUEUE

Returns a list of the elements in QUEUE.

Package

agutil

Source

functions.lisp (file)

Function: queue-empty? QUEUE

Returns true if QUEUE is empty.

Package

agutil

Source

functions.lisp (file)

Function: repeat-function FN N

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

Package

agutil

Source

functions.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: defmacro! NAME ARGS &rest BODY
Package

agutil

Source

let-over-lambda.lisp (file)

Macro: defmacro/g! NAME ARGS &rest BODY
Package

agutil

Source

let-over-lambda.lisp (file)

Macro: defun! NAME ARGS &body BODY
Package

agutil

Source

let-over-lambda.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: g!-symbol-p S
Package

agutil

Source

let-over-lambda.lisp (file)

Function: group SOURCE N
Package

agutil

Source

let-over-lambda.lisp (file)

Function: lol-flatten X
Package

agutil

Source

let-over-lambda.lisp (file)

Function: mkstr &rest ARGS
Package

agutil

Source

let-over-lambda.lisp (file)

Function: o!-symbol-p S
Package

agutil

Source

let-over-lambda.lisp (file)

Function: o!-symbol-to-g!-symbol S
Package

agutil

Source

let-over-lambda.lisp (file)

Function: symb &rest ARGS
Package

agutil

Source

let-over-lambda.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   A   F   L  
Index Entry  Section

A
agutil.asd: The agutil<dot>asd file
agutil/functions.lisp: The agutil/functions<dot>lisp file
agutil/let-over-lambda.lisp: The agutil/let-over-lambda<dot>lisp file
agutil/macros.lisp: The agutil/macros<dot>lisp file
agutil/package.lisp: The agutil/package<dot>lisp file

F
File, Lisp, agutil.asd: The agutil<dot>asd file
File, Lisp, agutil/functions.lisp: The agutil/functions<dot>lisp file
File, Lisp, agutil/let-over-lambda.lisp: The agutil/let-over-lambda<dot>lisp file
File, Lisp, agutil/macros.lisp: The agutil/macros<dot>lisp file
File, Lisp, agutil/package.lisp: The agutil/package<dot>lisp file

L
Lisp File, agutil.asd: The agutil<dot>asd file
Lisp File, agutil/functions.lisp: The agutil/functions<dot>lisp file
Lisp File, agutil/let-over-lambda.lisp: The agutil/let-over-lambda<dot>lisp file
Lisp File, agutil/macros.lisp: The agutil/macros<dot>lisp file
Lisp File, agutil/package.lisp: The agutil/package<dot>lisp file

Jump to:   A   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

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

D
define-merged-package: Exported macros
defmacro!: Internal macros
defmacro/g!: Internal macros
defun!: Internal macros
dequeue: Exported functions
dohash: Exported macros

E
enqueue: Exported functions
enqueue-list: Exported functions

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

G
g!-symbol-p: Internal functions
gensyms: Exported functions
group: Internal functions

L
let-if: Exported macros
lol-flatten: Internal functions

M
Macro, define-merged-package: Exported macros
Macro, defmacro!: Internal macros
Macro, defmacro/g!: Internal macros
Macro, defun!: Internal macros
Macro, dohash: Exported macros
Macro, let-if: Exported macros
Macro, match-state: Exported macros
Macro, nlet: Exported macros
make-queue: Exported functions
match-state: Exported macros
merge-packages: Exported functions
mkstr: Internal functions

N
nlet: Exported macros

O
o!-symbol-p: Internal functions
o!-symbol-to-g!-symbol: Internal functions

Q
queue->list: Exported functions
queue-empty?: Exported functions

R
repeat-function: Exported functions

S
symb: Internal functions

Jump to:   D   E   F   G   L   M   N   O   Q   R   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   P   S  
Index Entry  Section

A
agutil: The agutil system
agutil: The agutil package

P
Package, agutil: The agutil package

S
System, agutil: The agutil system

Jump to:   A   P   S