24 lines
372 B
Common Lisp
24 lines
372 B
Common 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)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|