Should be a lambda expression

Discussion of Common Lisp
Post Reply
Hexoblade
Posts: 1
Joined: Sat May 26, 2012 2:58 pm

Should be a lambda expression

Post by Hexoblade » Sat May 26, 2012 3:01 pm

Here is the function causing problems:

Code: Select all

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

ERROR:

*** - SYSTEM::%EXPAND-FORM: (SETQ LIST1 APPEND LIST1 LIST X) should be a lambda expression
The following restarts are available:
ABORT :R1 Abort main loop
Last edited by nuntius on Sun May 27, 2012 8:15 am, edited 1 time in total.
Reason: add code tag

nuntius
Posts: 538
Joined: Sat Aug 09, 2008 10:44 am
Location: Newton, MA

Re: Should be a lambda expression

Post by nuntius » Sun May 27, 2012 8:14 am

(please write a bit more about what you are doing)

The error message is complaining about the ((setq ...)) form. The first thing after the opening parenthesis generally gets evaluated as a function; but (setq ...) isn't a function form. So get rid of one set of parens and this error will go away. If you need the parens to do multiple things, try (progn (thing1) (thing2)).

Post Reply