;; Two functions written live in the lecture on 5/10/2007 ;; The variable names were chosen by the class. ;; Note the use of a helper function ;; A function which reverses a list ;; so rev '(1 2 3) gives us '(3 2 1) (defun rev (mylist) (if (null mylist) nil (snoc (car mylist) (rev (cdr mylist))) ) ) ;; A helper function which is a bit like cons but puts the element ;; at the end instead of the beginning ;; So (snoc 1 '(2 3)) gives us '(2 3 1) (defun snoc (um err) (if (null err) (cons um '()) (cons (car err) (snoc um (cdr err))) ) )