Archived

This topic is now archived and is closed to further replies.

Vlion

frustrating lisp error

Recommended Posts

Vlion    151
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

Share this post


Link to post
Share on other sites
SiCrane    11839
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]

Share this post


Link to post
Share on other sites
Vlion    151
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

Share this post


Link to post
Share on other sites
SiCrane    11839
Probably you''ve got an expression that reduces to (endp 1), which the lisp environment complains about because 1 isn''t a list.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Use backquote

(list (list (car pos) (car neg)) (list (cadr pos) (cadr neg)))

=>

`((,(car pos) ,(car neg)) (,(cadr pos) ,(cadr neg)))

Share this post


Link to post
Share on other sites