列表应该是一个lambda表达式(list should be a lambda expressio

2019-10-17 06:31发布

我刚开始学习LISP和我刚开始我的头围绕它的逻辑,但我碰到的一个错误,我不能找到解决办法for..I'm肯定这是因为我误用地方括号或我滥用的功能一般,但我一直在现在凝视了一个小时,也没有取得任何进展!

(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

任何帮助将非常感激!

Answer 1:

如果你想程序,你需要学习编程语言的语法。

咨询Common Lisp的Hyperspec为Common Lisp的语法。 每个函数/宏/特殊运营商/ ... Common Lisp的是在Common Lisp的Hyperspec与它的语法描述。

请参阅让语法,IF。

LET预计绑定列表。

IFSETF是一种形式。 需要周围的括号。

NOT只有一个参数。



文章来源: list should be a lambda expression
标签: lambda lisp