How to Write Functions
DEFUN defines the new function and return as its value the name of the function.
It takes three parameters, which are implicitly quoted.
The form of the function definition is as follows:
(DEFUN function_name parameter_list
function_body )
where:
function_name
is an identifier, as an atom;
parameter_list
is a list (possibly empty) of identifiers, as a list of atoms; and
function_body
is an S-expression representing the body of the function.
Given an atom A
and a list of atoms LAT
, the following code determines whether A
occurs in LAT
:
Actually, the above code check( )
is the same as the Lisp built-in function MEMBER.
The following error message will be displayed if the you try to redefine the MEMBER
by replacing check( )
by member( )
:
** - Continuable Error
DEFUN/DEFMACRO(MEMBER): # is locked
If you continue (by typing 'continue'):
Ignore the lock and proceed