Common Lisp Package: LPARALLEL.UTIL

(private) Miscellaneous utilities.

README:

FUNCTION

Public

ENSURE-FUNCTION (FUNCTION-DESIGNATOR)

Returns the function designated by FUNCTION-DESIGNATOR: if FUNCTION-DESIGNATOR is a function, it is returned, otherwise it must be a function name and its FDEFINITION is returned.

INTERACT (&REST PROMPT)

Read from user and eval.

SYMBOLICATE (&REST THINGS)

Concatenate together the names of some strings and symbols, producing a symbol in the current package.

Undocumented

TO-BOOLEAN (X)

UNSPLICE (FORM)

Private

FORMAT-SYMBOL (PACKAGE CONTROL &REST ARGUMENTS)

Constructs a string by applying ARGUMENTS to string designator CONTROL as if by FORMAT within WITH-STANDARD-IO-SYNTAX, and then creates a symbol named by that string. If PACKAGE is NIL, returns an uninterned symbol, if package is T, returns a symbol interned in the current package, and otherwise returns a symbol interned in the package designated by PACKAGE.

PARSE-BODY (BODY &KEY DOCUMENTATION WHOLE)

Parses BODY into (values remaining-forms declarations doc-string). Documentation strings are recognized only if DOCUMENTATION is true. Syntax errors in body are signalled and WHOLE is used in the signal arguments when given.

SYMBOLICATE/NO-INTERN (&REST STRING-DESIGNATORS)

Concatenate `string-designators' then make-symbol the result.

SYMBOLICATE/PACKAGE (PACKAGE &REST STRING-DESIGNATORS)

Concatenate `string-designators' then intern the result into `package'.

Undocumented

CONSTRAIN-RETURN-TYPE (RETURN-TYPE)

DEFSLOTS-NAMES (NAME)

HAS-LAMBDA-KEYWORDS-P (LIST)

MKLIST (X)

PARSE-DEFSLOTS (SUPERS SLOTS OPTIONS)

PLIST-KEYS (PLIST)

PLIST-VALUES-FOR-KEY (PLIST TARGET-KEY)

MACRO

Public

DEFMACRO/ONCE (NAME PARAMS &BODY BODY)

Like `defmacro' except that params which are immediately preceded by `&once' are passed to a `once-only' call which surrounds `body'.

DEFPAIR (NAME SUPERS (A B) &OPTIONAL DOC)

Define a cons type using defclass syntax. Exactly two slots and zero superclasses must be given. Available slot options are: `:initform', `:type', `:reader'. A deftype for `name' is defined. `(defpair foo ...)' defines the function `make-foo-instance' which takes keyword arguments corresponding to slots of the same name. All slots must be initialized when an instance is created, else an error will be signaled.

DEFSLOTS (NAME SUPERS SLOTS &REST OPTIONS)

Define a thing with slots. A `defslots' form may expand to either a `defclass' form or a `defstruct' form. Thou art foolish to depend upon either. The syntax of `defslots' matches that of `defclass' with the following restrictions: at most one superclass is permitted; `:initform', `:type', and `:reader', are the only slot options allowed; `:documentation' is the only class option allowed. `(defslots foo ...)' defines the functions `make-foo-instance' and `with-foo-slots' which are like `make-instance' and `with-slots' respectively. `make-foo-instance' takes keyword arguments corresponding to slots of the same name. All slots must be initialized when an instance is created, else an error will be signaled.

DEFUN/INLINE (NAME PARAMS &BODY BODY)

Shortcut for (declaim (inline foo)) (defun foo ...).

DEFUN/TYPE (NAME PARAMS ARG-TYPES RETURN-TYPE &BODY BODY)

Shortcut for (declaim (ftype (function arg-types return-type) foo) (defun foo ...). Additionally constrains return-type to the number of values provided.

UNWIND-PROTECT/EXT (&KEY PREPARE MAIN CLEANUP ABORT)

Extended `unwind-protect'. `prepare' : executed first, outside of `unwind-protect' `main' : protected form `cleanup' : cleanup form `abort' : executed if `main' does not finish

WHEN-LET (BINDINGS &BODY FORMS)

Creates new variable bindings, and conditionally executes FORMS. BINDINGS must be either single binding of the form: (variable initial-form) or a list of bindings of the form: ((variable-1 initial-form-1) (variable-2 initial-form-2) ... (variable-n initial-form-n)) All initial-forms are executed sequentially in the specified order. Then all the variables are bound to the corresponding values. If all variables were bound to true values, then FORMS are executed as an implicit PROGN.

WITH-GENSYMS (NAMES &BODY FORMS)

Binds each variable named by a symbol in NAMES to a unique symbol around FORMS. Each of NAMES must either be either a symbol, or of the form: (symbol string-designator) Bare symbols appearing in NAMES are equivalent to: (symbol symbol) The string-designator is used as the argument to GENSYM when constructing the unique symbol the named variable will be bound to.

WITH-PARSED-BODY ((DOCSTRING DECLARES BODY) &BODY OWN-BODY)

Pop docstring and declarations off `body' and assign them to the variables `docstring' and `declares' respectively. If `docstring' is nil then no docstring is parsed.

Undocumented

ALIAS-FUNCTION (ALIAS ORIG)

ALIAS-MACRO (ALIAS ORIG)

DEFUN/TYPE/INLINE (NAME PARAMS ARG-TYPES RETURN-TYPE &BODY BODY)

DOSEQUENCE ((VAR SEQUENCE &OPTIONAL RETURN) &BODY BODY)

IMPORT-NOW (&REST SYMBOLS)

REPEAT (N &BODY BODY)

UNTIL (TEST &BODY BODY)

WHILE (TEST &BODY BODY)

Private

ONCE-ONLY (SPECS &BODY FORMS)

Evaluates FORMS with symbols specified in SPECS rebound to temporary variables, ensuring that each initform is evaluated only once. Each of SPECS must either be a symbol naming the variable to be rebound, or of the form: (symbol initform) Bare symbols in SPECS are equivalent to (symbol symbol) Example: (defmacro cons1 (x) (once-only (x) `(cons ,x ,x))) (let ((y 0)) (cons1 (incf y))) => (1 . 1)

Undocumented

DEFINE-READER (PUBLIC PRIVATE TYPE STRUCT)

DEFINE-READERS (STRUCT CONC-NAME SLOTS)

DEFINE-SLOTS-MACROLET (PACKAGE CONC-NAME ENTRIES INSTANCE &BODY BODY)

DEFINE-STRUCT (NAME SUPERS SLOTS OPTIONS CONC-NAME CONSTRUCTOR)

DEFINE-WITH-SLOTS-MACRO (NAME PACKAGE CONC-NAME)

VARIABLE

Public

Undocumented

*FULL-OPTIMIZE*

*NORMAL-OPTIMIZE*

Private

Undocumented

*DEFSLOTS-DOC*