0

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

1
  • 4
    Please indent things properly. Commented May 27, 2012 at 2:07

2 Answers 2

1

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))
Sign up to request clarification or add additional context in comments.

Comments

0

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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.