user1419501
user1419501

Reputation: 13

Should be a lambda expression-LISP

Just one function of my code:

(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

Any help is appreciated

Upvotes: 0

Views: 510

Answers (2)

user797257
user797257

Reputation:

Using de Morgan's laws you could construct your condition differently:

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

avoiding the use of progn altogether (not that it's a bad thing, but it's often times frowned upon).

Upvotes: 0

GoZoner
GoZoner

Reputation: 70215

The alternate expression for the 'if' expression is ((set! ...) ...). The first position needs to be either a function or a syntactic form. In this case you need progn as:

(progn
  (setq list1 ...)
  (setq list2 ...)
  (eql x y))

Upvotes: 1

Related Questions