transcendental-lisp/lisp/lang/reverse.lisp

17 lines
362 B
Common Lisp

(load "functions.lisp")
(defun reverse (the-list)
(if the-list
(append
(reverse (rest the-list))
(list (first the-list)))))
(defun deep-reverse (the-list)
(if the-list
(append
(deep-reverse (rest the-list))
(list
(if (listp (first the-list))
(deep-reverse (first the-list))
(first the-list))))))