【发布时间】:2012-09-24 08:59:48
【问题描述】:
我刚刚开始学习 LISP,我只是在思考它的逻辑,但是我遇到了一个错误,我找不到解决方案。我确定这是因为我我在某处误用了括号,或者我在一般情况下误用了一个函数,但我已经盯着它看了一个小时,没有任何进展!
(defun not-touching (pos player move)
(let (legal? t)
if ((not (eq (member move '(0 1 2 3 4 7 8 11 12 13 14 15)) nil))
(mapcar #'(lambda(x) (if (not (member move x) nil)
(cond ((and (eq (nth (- (position move x) 1) x) nil)
(not (eq (nth (+ (position move x) 1) x) player))) t)
((and (not (eq (nth (- (position move x) 1) x) player))
(not (eq (nth (+ (position move x) 1) x) player))) t)
((and (not (eq (nth (- (position move x) 1) x) player))
(eq (nth (+ (position move x) 1) x) nil)) t)
(t setf legal? nil))
nil)) *outside-lines*))
legal?))
我得到的错误如下所示:
SYSTEM::%EXPAND-FORM: (NOT (EQ (MEMBER MOVE '(0 1 2 3 4 7 8 11 12 13 14 15)) NIL)) should be
a lambda expression
任何帮助将不胜感激!
【问题讨论】:
-
括号太多。在
not之前去掉一个,否则看起来像一个函数应用程序。而且您在let中缺少括号。