transcendental-lisp/lisp/reverse.lisp

24 lines
567 B
Common Lisp

(defun reverse (the-list)
(cond
(the-list (append (reverse (rest the-list))
(list (first the-list))
)
)
)
)
(defun deep-reverse (the-list)
(cond
(the-list (append (deep-reverse (rest the-list))
(list (cond
((listp (first the-list))
(deep-reverse (first the-list))
)
(t (first the-list))
)
)
)
)
)
)