【发布时间】:2016-10-08 09:37:28
【问题描述】:
我正在尝试在 lisp 中创建深度反向函数。例如:
(a (b c d) e) -> (e (d c b) a)
这是我的代码。
(defun deeprev (l)
(cond ((null l) nil)
((list (car l)) (append (deeprev (cdr l)) (deeprev (car l))))
(t (append (deeprev (cdr l))(car l)))
)
)
每当我编译和加载时,我都会出错:
Error: Attempt to take the car that is not listp
【问题讨论】:
标签: recursion lisp common-lisp reverse