9 Appendix: Standard LISP extensions

The following typical LISP functions are defined in the support module of the rlisp package.

atsoc(u:any,p:alist)

Same as assoc, but using the operator eq instead of equal for the search. atsoc can be applied only if the identity of the object to be searched for is guaranteed, e.g. for symbols. It is substantially faster than assoc.

copyd(u:id,v:id)

Copies the procedure definition of v to the symbol u. Afterwards the procedure can be called by using the name u. Frequently used for embedding a function, e.g. for implementing a private trace:

  if null getd ’myprog_old then copyd(’myprog_old,’myprog);  
  symbolic procedure myprog(u);  
    <<print {"calling myprog with parameter ",u};  
      myprog_old(u)>>

eqcar(u:any,v:any)

Implements the frequently needed test pairp u and car u eq v.

listp(u:any)

Returns t if u is a top level list ending with a nil.

mkquote(u:any)

tags u with a quote. This function is useful for cases where a LISP eval situation is given, e.g. for coding for an errorset or for writepri.

reversip(u:list)

Reverses the elements of l in place - faster than reverse, but desctroys the input list.

smember(u:any,v:any)

Similar to member this routine tests whether u occurs in the structure v, however in an arbitrarily deep nesting. While member tests only the top level list, smember descends down all branches of the tree.

smemq(u:any,v:any)

Same as smember, however using eq as test instead of equal.

The following routines handle lists as sets (every element at most once):

union(u:any,v:any)

intersection(u:any,v:any)

setdiff(u:any,v:any)

The Standard LISP apply function requires that the parameters for the function to be applied are encoded as a list. For standard cases of 1,2 or 3 parameters the following variants allow an easier encoding:

apply1(u:id,u:any)

apply2(u:id,u:any,v:any)

apply3(u:id,u:any,v:any,w:any)


Services provided by
SourceForge