The trivial-utilities Reference Manual

This is the trivial-utilities Reference Manual, version 0.4.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:09:16 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 trivial-utilities

A collection of useful functions and macros.

Author

Eric Diethelm <>

License

MIT

Version

0.4.0

Dependencies
  • alexandria (system).
  • iterate (system).
  • closer-mop (system).
Source

trivial-utilities.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 trivial-utilities/trivial-utilities.asd

Source

trivial-utilities.asd.

Parent Component

trivial-utilities (system).

ASDF Systems

trivial-utilities.


3.1.2 trivial-utilities/package.lisp

Source

trivial-utilities.asd.

Parent Component

trivial-utilities (system).

Packages

trivial-utilities.


3.1.3 trivial-utilities/trivial-utilities.lisp

Source

trivial-utilities.asd.

Parent Component

trivial-utilities (system).

Public Interface

4 Packages

Packages are listed by definition order.


4.1 trivial-utilities

trivial-utilities is a collection of useful functions and macros.

Source

package.lisp.

Use List

common-lisp.

Public Interface

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: aif (test then &optional else)

Similar to the normal *IF*, but binds the result of *TEST* via *LET* to *IT*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: alambda (parms &body body)

Similar to *LAMBDA*, but defines *SELF* via *LABELS* which contains the *BODY*. *SELF* can be referenced in *BODY*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: aprog1 (first &body body)

Similar to the normal *PROG1*, but binds the result of *FIRST* via *LET* to *IT* and returns *IT*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: aunless (test &body else)

Similar to the normal *UNLESS*, but binds the result of *TEST* via *LET* to *IT*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: awhen (test &body then)

Similar to the normal *WHEN*, but binds the result of *TEST* via *LET* to *IT*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: blambda (parms &body body)

Similar to *LAMBDA*, but defines an unnamed *BLOCK* from which one can *RETURN*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: extract-additional-keys ((keys args) &body body)

Convenience macro to extract keywords including default values from a plist, such as (:a 1 :b 2 :c 3). Usually used in conjunction with (&rest keys &key &allow-other-keys). *KEYS* - The keys to be extracted. This follows the syntax of **let**. Example: ((a nil) b (c t c-was-in-args-p))
*ARGS* - A property list of keyword-value pairs
*BODY* - Code to be executed and which uses the extracted keys.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Macro: once-only ((&rest names) &body body)

Protects against multiple evaluation of *NAMES* during macro-expansion. Usualy used inside of other macros.

Package

trivial-utilities.

Source

trivial-utilities.lisp.


5.1.2 Ordinary functions

Function: all-slots (class)

Create a list containing all slots defined for *class*, including slots defined (recursively) in all superclasses.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: collect-persistent-slots (instance &key slots-to-ignore)

Any slot which defines :initarg, is bound to a value and is not listed in *slots-to-ignore* will be appended in the form (initarg value).

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: demultiplex (input &optional bindings)

Given a *LIST* of *LIST*s returns all combinations of the elements in each of the *LIST*s in *INPUT*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: merge-lambda-lists (&rest lists)

Given two lambda lists, return one representing the unification of both.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: mklist (obj)

Returns a new list containing *OBJ*, or *OBJ* itself if it is already a list.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: mkstr (&rest args)

Creates a string out of all elements in *ARGS*. Each element must be printable per *PRINC*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: partition (pred seq)

Separates the contents of *SEQ* into two lists, depending on the result of *PRED* when applied to each element of *SEQ*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: single (lst)

Predicate verifying that *LST* is a list containing exactly one element.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Function: symb (&rest args)

Creates a new and internalized *SYMBOL*, named by applying *MKSTR* to *ARGS*.

Package

trivial-utilities.

Source

trivial-utilities.lisp.


5.1.3 Generic functions

Generic Function: clone (obj &key &allow-other-keys)

A generic function to clone objects.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Generic Function: equals (obj1 obj2 &key &allow-other-keys)

A generic equality comparison function.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Methods
Method: equals (obj1 obj2 &key &allow-other-keys)

Default method if all other cases fail. Uses cl:equal for comparison.

Method: equals ((obj1 null) (obj2 null) &key &allow-other-keys)

Equality comparison of two *NULL* symbols always results in *T*.

Method: equals ((obj1 list) (obj2 list) &key &allow-other-keys)

Equality comparison of two *LIST*s requires both to have the same length and each element to be equaly comparable (*EQUALS*).

Method: equals ((obj1 string) (obj2 string) &key &allow-other-keys)

Equality comparison of two *STRING*s falls back to *string=*.

Generic Function: flatten (obj)

Flattens the structure of an object.

An implementation for *LIST*s already exists. Add specific implementations for special objects.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Methods
Method: flatten (obj)

Returns a list with the flatten contents of the *LIST* *OBJ*.

Method: flatten ((obj null))

5.1.4 Types

Type: negative-fixnum ()

Defines all negative integer types upto and including -1.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Type: non-negative-fixnum ()

Defines all non-negative integer types starting from and including 0.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Type: non-positive-fixnum ()

Defines all non-positive integer types upto and including 0.

Package

trivial-utilities.

Source

trivial-utilities.lisp.

Type: positive-fixnum ()

Defines all positive integer types starting from and including 1.

Package

trivial-utilities.

Source

trivial-utilities.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   D   E   F   G   M   O   P   S  
Index Entry  Section

A
aif: Public macros
alambda: Public macros
all-slots: Public ordinary functions
aprog1: Public macros
aunless: Public macros
awhen: Public macros

B
blambda: Public macros

C
clone: Public generic functions
collect-persistent-slots: Public ordinary functions

D
demultiplex: Public ordinary functions

E
equals: Public generic functions
equals: Public generic functions
equals: Public generic functions
equals: Public generic functions
equals: Public generic functions
extract-additional-keys: Public macros

F
flatten: Public generic functions
flatten: Public generic functions
flatten: Public generic functions
Function, all-slots: Public ordinary functions
Function, collect-persistent-slots: Public ordinary functions
Function, demultiplex: Public ordinary functions
Function, merge-lambda-lists: Public ordinary functions
Function, mklist: Public ordinary functions
Function, mkstr: Public ordinary functions
Function, partition: Public ordinary functions
Function, single: Public ordinary functions
Function, symb: Public ordinary functions

G
Generic Function, clone: Public generic functions
Generic Function, equals: Public generic functions
Generic Function, flatten: Public generic functions

M
Macro, aif: Public macros
Macro, alambda: Public macros
Macro, aprog1: Public macros
Macro, aunless: Public macros
Macro, awhen: Public macros
Macro, blambda: Public macros
Macro, extract-additional-keys: Public macros
Macro, once-only: Public macros
merge-lambda-lists: Public ordinary functions
Method, equals: Public generic functions
Method, equals: Public generic functions
Method, equals: Public generic functions
Method, equals: Public generic functions
Method, flatten: Public generic functions
Method, flatten: Public generic functions
mklist: Public ordinary functions
mkstr: Public ordinary functions

O
once-only: Public macros

P
partition: Public ordinary functions

S
single: Public ordinary functions
symb: Public ordinary functions


A.3 Variables