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: Given an atom A and a list of atoms LAT, the following code determines whether A occurs in LAT:

   (defun check  (a lat)
     (cond
       ((null  lat)         nil) 
       ((eq  a (car  lat))  T)
       (T                   (check  a (cdr  lat))) ) )

   (check  '  ')
   

       


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