Examples of function definitions 

 

1.       Write a function that will add 3 to a single number.

        

           (defun  plus3  (n)

                 (+ 3 n))

 

 

 

2.     Write a function that will add 3 to each of a list of numbers

 

(defun listplus3 (list)

     (cond

        ((null list)  nil)     ; is the list empty

        ( (numberp list)  (+ 3 list))  ; does the list have a single number?

        ( t  (cons  (listplus3 (car list)) (listplus3 (cdr list))))

     )

)