English 中文(简体)
应该是羔羊表达式LISP
原标题:Should be a lambda expression-LISP

只是我代码的一个功能:

(defun equalprev (x y)
  (cond ((or (atom x) (atom y))
         (if (not (null isLoop))
             t
           ((setq list1 (append list1 (list x)))
            (setq list2 (append list2 (list y)))
            (eql x y))))
        ((equalprev (car x) (car y))
         (equalprev (cdr x) (cdr y)))))

*** - SYSTEM::%EXPAND-FORM: (SETQ LIST1 (APPEND LIST1 (LIST X))) should be a `lambda`
expression
The following restarts are available:
ABORT          :R1      Abort main loop

感谢任何帮助

最佳回答

如果表达式是 ((set....)..., 则该表达式的替代表达式。 第一个位置必须是函数或同义形式。 在这种情况下, 您需要以下列方式进行查看:

(progn
  (setq list1 ...)
  (setq list2 ...)
  (eql x y))
问题回答

使用德摩根法律 你可以用不同的方式构建你的状况:

(not
 (when (null isLoop)
   (setq list1 (append list1 (list x)))
   (setq list2 (append list2 (list y)))
   (not (eql x y))))

避免使用progn(不是说这是坏事,而是说它经常被皱眉)





相关问题
Lisp code called from Java

Long story: I am doing a project for my functional programing class, and I thought of writing an AI controller in Lisp, for the Mario AI competition. I was looking over frameworks/libraries/ways of ...

Emacs, Zen-Coding mode, and Putty

I use emacs via Putty and since Putty doesn t send certain key combinations to the remote console I generally need to re-bind them to other key combinations. After installing the amazing Zen-Coding ...

In Which Cases Is Better To Use Clojure? [closed]

I develop in Lisp and in Scheme, but I was reading about Clojure and then I want to know, in which cases is better to use it than using Lisp or Scheme? Thanks

lambda-gtk negative pointer

I was trying to write my own put-pixel on (Gdk) pixbuf in Lisp. When I finally realized how I can operate on C pointers in CL, new obstacle came along - (gdk:pixbuf-get-pixels pb) returns me negative ...

Is there a common lisp package naming convention?

I have created some of my own user packages and have run into a name clash. In Java, the naming convention is to use your domain name in the package name: e.g. import com.example.somepackage;. Are ...

SOAP request from within an AutoLISP/AutoCAD macro

We have built a webservice for a client that uses AutoCAD. They have a macro that runs in AutoCAD that builds a SOAP request. But they have not figured out how to actually send() the soap request to ...

热门标签