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*- (Special syntax) This is the same as
`(QUOTE`

.*S*) `(LIST`

*S1 S2*...)- Form a list of the (evaluated) arguments
*S1*,*S2*, .... `(CAAR`

*NEL*)- Same as
`(CAR (CAR`

. The first element of*NEL*))*NEL*must itself be a nonempty list; this function returns the first element in that nested list. `(CADR`

*NEL*)- Same as
`(CAR (CDR`

. Returns the second element of*NEL*))*NEL*(*NEL*must have at least two elements). `(CDAR`

*NEL*)- Same as
`(CDR (CAR`

. The first element of*NEL*))*NEL*must itself be a nonempty list. `(CDDR`

*NEL*)- Same as
`(CDR (CDR`

. Returns the result of removing the first two elements from the list*NEL*))*NEL*(*NEL*must have at least two elements).Various LISPs define additional functions whose names consist of a

`C`

, some number of`A`

s and`D`

s, and an`R`

, with the obvious meanings. Common LISP allows up to four`A`

s and`D`

s. `(SETQ`

*A S*)- Assign to the (unevaluated) atom
*A*the value obtained by evaluating*S*. Hereafter, when*A*is evaluated, this is the value that will be returned.

`(LIST`

*S1 S2*...)- Form a list of the (evaluated) arguments
*S1*,*S2*, .... `(MEMBER`

*S L*)- Test whether
*S*is a top-level (i.e. not embedded in a sublist) element of*L*. `(APPEND`

*L1 L2*...)- Make a new list from the elements of
*L1*,*L2*, ..., in order. `(REVERSE`

*L*)- Return a list containing the same elements as
*L*but in reverse order. `(LENGTH`

*L*)- Returns the length of
*L*, that is, the number of top-level elements in*L*.

`(LISTP`

*S*)- True if
*S*is a list. `(NUMBERP`

*S*)- True if
*S*is a number. `(NOT`

*S*)- True if
*S*is false, and false if*S*is true. Same as`(NULL`

.*S*) `(EQUAL`

*S1 S2*)- True if
*S1*and*S2*are equal. Like`EQ`

, but may be used for anything. `(ZEROP`

*N*)- True if number
*N*is zero. `(PLUSP`

*N*)- True if number
*N*is positive. `(MINUSP`

*N*)- True if number
*N*is negative. `(EVENP`

*N*)- True if integer
*N*is even. `(ODDP`

*N*)- True if integer
*N*is odd.

`(+`

*N1 N2*...)- Returns the sum of the numbers.
`(-`

*N1 N2*...)- Returns the result of subtracting all subsequent numbers from
*N1*. `(*`

*N1 N2*...)- Returns the product of all the numbers.
`(/`

*N1 N2*...)- Returns the result of dividing
*N1*by all subsequent numbers. `(1+`

*N*)- Returns
*N*plus one. (Note that there is no space between the "`1`

" and the "`+`

".) `(1-`

*N*)`Returns`

*N*minus one. (Note that there is no space between the "`1`

" and the "`-`

".)`(/`

*N*)- Return the reciprocal of
*N*.

`(LOAD`

*F*)- Load the source file whose name (without extensions) is
*F*. `(DRIBBLE`

*F*)- Causes the current session to be recorded file whose name (without extensions)
is
*F*. To stop recording, call`(DRIBBLE)`

with no parameters.*Not available on all systems.* `(PRIN1`

*S*)- Print, on the current line, the result of evaluating the S-expression
*S*. `(TERPRI)`

- Print a newline.

All rights reserved.