transcendental-lisp/lisp/reverse.lisp

24 lines
567 B
Common Lisp
Raw Normal View History

2016-12-07 14:16:45 -05:00
(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))
)
)
)
)
)
)