frustrating lisp error

Started by
4 comments, last by Vlion 20 years, 3 months ago
I''m trying to setup a list of this form ((...) (...) etc) So I write this in the interpreter(clisp) (setq pos ''(1 2 3 4 5)) (setq neg ''(-1 -2 -3 -4 -5)) I want to pair each member with all the other members- a permutation, I guess. So it will look like: ((1 -1) (1 -2) (1 -3) ... (2 -1) ... ) each pair being unordered As a test, I write this line, which I want to give ((1 -1)): (( (first pos) (first neg) )) And out pops this error: *** - EVAL: ((FIRST POS) (FIRST NEG)) is not a function name I''ve put ''s all over the place and I can''t get it to work. The search engines have been quite unhelpful too. Beating head against wall hasn''t helped either. (help please) ~V''lion Bugle4d
~V'lionBugle4d
Advertisement
Did you try using the list special form? e.g.
(list (list (car pos) (car neg)) (list (cadr pos) (cadr neg)))
should give ((1 -1) (2 -2))

edit: left out a parentheses

[edited by - SiCrane on January 3, 2004 12:04:54 AM]
That works.

Thanks lots !!!
~V'lionBugle4d
On the sibject of lisp errors, I''m getting this quite incomprehensible error.

*** - ENDP: A true list must not end with 1

What is that trying to tell me ?

Thanks !

~V''lion

Bugle4d
~V'lionBugle4d
Probably you''ve got an expression that reduces to (endp 1), which the lisp environment complains about because 1 isn''t a list.
Use backquote
(list (list (car pos) (car neg)) (list (cadr pos) (cadr neg)))=>`((,(car pos) ,(car neg)) (,(cadr pos) ,(cadr neg))) 

This topic is closed to new replies.

Advertisement