Common Lisp Package: PAIPROLOG.AUXFNS

README:

FUNCTION

Public

BINDING-VAL (BINDING)

Get the value part of a single binding.

BINDING-VAR (BINDING)

Get the variable part of a single binding.

CLEAR-MEMOIZE (FN-NAME)

Clear the hash table from a memo function.

DBG (ID FORMAT-STRING &REST ARGS)

Print debugging info if (DEBUG ID) has been specified.

DBG-INDENT (ID INDENT FORMAT-STRING &REST ARGS)

Print indented debugging info if (DEBUG ID) has been specified.

DEBUG (&REST IDS)

Start dbg output on the given ids.

DEQUEUE (Q)

Remove an item from the front of the queue.

ENQUEUE (ITEM Q)

Insert item at the end of the queue.

EXTEND-BINDINGS (VAR VAL BINDINGS)

Add a (var . value) pair to a binding list.

FIND-ALL (ITEM SEQUENCE &REST KEYWORD-ARGS &KEY (TEST #'EQL) TEST-NOT &ALLOW-OTHER-KEYS)

Find all those elements of sequence that match item, according to the keywords. Doesn't alter sequence.

FIND-ALL-IF (PREDICATE SEQUENCE &REST ARGS &KEY FROM-END (START 0) (END NIL) (COUNT NIL) (KEY NIL))

Return a copy of sequence with elements not satisfying PREDICATE removed.

FIND-ANYWHERE (ITEM TREE)

Does item occur anywhere in tree?

FIND-IF-ANYWHERE (PREDICATE TREE)

Does predicate apply to any atom in the tree?

FIRST-OR-NIL (X)

The first element of x if it is a list; else nil.

FIRST-OR-SELF (X)

The first element of x, if it is a list; else x itself.

FLATTEN (EXP)

Get rid of imbedded lists (to one level only).

FORCE (DELAY)

Do a delayed computation, or fetch its previously-computed value.

GET-BINDING (VAR BINDINGS)

Find a (variable . value) pair in a binding list.

LAST1 (LIST)

Return the last element (not last cons cell) of list

LENGTH=1 (X)

Is x a list of length 1?

LOOKUP (VAR BINDINGS)

Get the value part (for var) from a binding list.

MAKE-QUEUE

Build a new queue, with no elements.

MAPPEND (FN LIST)

Append the results of calling fn on each element of list. Like mapcon, but uses append instead of nconc.

MATCH-VARIABLE (VAR INPUT BINDINGS)

Does VAR match input? Uses (or updates) and returns bindings.

MAYBE-ADD (OP EXPS &OPTIONAL IF-NIL)

For example, (maybe-add 'and exps t) returns t if exps is nil, exps if there is only one, and (and exp1 exp2...) if there are several exps.

MAYBE-SET-FILL-POINTER (ARRAY NEW-LENGTH)

If this is an array with a fill pointer, set it to new-length, if that is longer than the current length.

MEMO (FN &KEY (KEY #'FIRST) (TEST #'EQL) NAME)

Return a memo-function of fn.

MEMOIZE (FN-NAME &KEY (KEY #'FIRST) (TEST #'EQL))

Replace fn-name's global definition with a memoized version.

MKLIST (X)

If x is a list return it, otherwise return the list of x

NEW-SYMBOL (&REST ARGS)

Concatenate symbols or strings to form an uninterned symbol

PARTITION-IF (PRED LIST)

Return 2 values: elements of list that satisfy pred, and elements that don't.

PAT-MATCH (PATTERN INPUT &OPTIONAL (BINDINGS NO-BINDINGS))

Match pattern against input in the context of the bindings

QUEUE-NCONC (Q LIST)

Add the elements of LIST to the end of the queue.

RANDOM-ELT (SEQ)

Pick a random element out of a sequence.

REST2 (X)

The rest of a list after the first TWO elements.

REST3 (LIST)

The rest of a list after the first THREE elements.

REUSE-CONS (X Y X-Y)

Return (cons x y), or reuse x-y if it is equal to (cons x y)

SEQ-REF (SEQ INDEX)

Return code that indexes into a sequence, using the pop-lists/aref-vectors strategy.

SIDE-EFFECT-FREE? (EXP)

Is exp a constant, variable, or function, or of the form (THE type x) where x is side-effect-free?

SORT* (SEQ PRED &KEY KEY)

Sort without altering the sequence

STARTS-WITH (LIST X)

Is x a list whose first element is x?

SYMBOL (&REST ARGS)

Concatenate symbols or strings to form an interned symbol

UNDEBUG (&REST IDS)

Stop dbg on the ids. With no ids, stop dbg altogether.

UNIQUE-FIND-IF-ANYWHERE (PREDICATE TREE &OPTIONAL FOUND-SO-FAR)

Return a list of leaves of tree satisfying predicate, with duplicates removed.

VARIABLE-P (X)

Is x a variable (a symbol beginning with `?')?

Undocumented

COMPOSE (&REST FUNCTIONS)

EMPTY-QUEUE-P (Q)

FRONT (Q)

MAKE-BINDING (VAR VAL)

MEMBER-EQUAL (ITEM LIST)

NOT-NULL (X)

QUEUE-CONTENTS (Q)

Private

DELAY-COMPUTED? (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

DELAY-VALUE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

Undocumented

COPY-DELAY (INSTANCE)

SETFDELAY-COMPUTED? (NEW-VALUE INSTANCE)

DELAY-P (OBJECT)

SETFDELAY-VALUE (NEW-VALUE INSTANCE)

MAKE-DELAY (&KEY ((VALUE DUM521) NIL) ((COMPUTED? DUM522) NIL))

MACRO

Public

DEFINE-ENUMERATED-TYPE (TYPE &REST ELEMENTS)

Represent an enumerated type with integers 0-n.

DEFUN-MEMO (FN ARGS &BODY BODY)

Define a memoized function.

DELAY (&REST BODY)

A computation that can be executed later by FORCE.

ONCE-ONLY (VARIABLES &REST BODY)

Returns the code built by BODY. If any of VARIABLES might have side effects, they are evaluated once and stored in temporary variables that are then passed to BODY.

READ-TIME-CASE (FIRST-CASE &REST OTHER-CASES)

Do the first case, where normally cases are specified with #+ or possibly #- marks.

WITH-RESOURCE ((VAR RESOURCE &OPTIONAL PROTECT) &REST BODY)

Execute body with VAR bound to an instance of RESOURCE.

Undocumented

DEFRESOURCE (NAME &KEY CONSTRUCTOR (INITIAL-COPIES 0) (SIZE (MAX INITIAL-COPIES 10)))

FUNCALL-IF (FN ARG)

VARIABLE

Private

*DBG-IDS*

Identifiers used by dbg

CLASS

Public

Undocumented

DELAY (&REST BODY)

CONSTANT

Public

Undocumented

FAIL

NO-BINDINGS