| VIII. Additional built-in functions |
LISP implementations typically have a large number of built-in functions. However, these functions are not standardized. Even some of the most fundamental operations may have different names, or vary somewhat in operation, from one implementation to the next. Hence, the following list of functions should be regarded as tentative.
In the following, A stands for an atom, L stands for a list, NEL stands for a nonempty list, N stands for a number, and S stands for an arbitrary S-expression.
'S
(QUOTE S).(LIST S1 S2 ...)
(CAAR NEL)
(CAR (CAR NEL)). The first element of NEL must itself be a nonempty list; this function returns the first element in that nested list.(CADR NEL)
(CAR (CDR NEL)). Returns the second element of NEL (NEL must have at least two elements).(CDAR NEL)
(CDR (CAR NEL)). The first element of NEL must itself be a nonempty list.(CDDR NEL)
(CDR (CDR NEL)). Returns the result of removing the first two elements from the list NEL (NEL must have at least two elements).
Various LISPs define additional functions whose names consist of a C, some number of As and Ds, and an R, with the obvious meanings. Common LISP allows up to four As and Ds.
(SETQ A S)
(LIST S1 S2 ...)
(MEMBER S L)
(APPEND L1 L2 ...)
(REVERSE L)
(LENGTH L)
(LISTP S)
(NUMBERP S)
(NOT S)
(NULL S).(EQUAL S1 S2)
EQ, but may be used for anything.(ZEROP N)
(PLUSP N)
(MINUSP N)
(EVENP N)
(ODDP N)
(+ N1 N2 ...)
(- N1 N2 ...)
(* N1 N2 ...)
(/ N1 N2 ...)
(1+ N)
1" and the "+".)(1- N)
Returns N minus one. (Note that there is no space between the "1" and the "-".)(/ N)
(LOAD F)
(DRIBBLE F)
(DRIBBLE) with no parameters.
Not available on all systems.
(PRIN1 S)
(TERPRI)
|
|
|