Thanks everyone for the posts, the copy-tree version of the program works perfectly.
Thanks very much
Search found 6 matches
- Sat Jan 08, 2011 3:20 pm
- Forum: Common Lisp
- Topic: Cartesian product of 2 lists which is NOT dependent
- Replies: 8
- Views: 16057
- Thu Jan 06, 2011 12:48 pm
- Forum: Common Lisp
- Topic: Cartesian product of 2 lists which is NOT dependent
- Replies: 8
- Views: 16057
Re: Cartesian product of 2 lists which is NOT dependent
Oh ok, i see why thats messing up now.
Is there another way i can still create a cartesian product of 2 lists, like this , but have no dependencies? So that when i change certain items it only changes that particular item.
Thanks again
Is there another way i can still create a cartesian product of 2 lists, like this , but have no dependencies? So that when i change certain items it only changes that particular item.
Thanks again
- Wed Jan 05, 2011 4:36 pm
- Forum: Common Lisp
- Topic: Cartesian product of 2 lists which is NOT dependent
- Replies: 8
- Views: 16057
Re: Cartesian product of 2 lists which is NOT dependent
Ok, so here is a typical command id be using. (sorry for the ridiculous length, its just the only example i know the error happens). Im using GNU CLISP 2.49 >(setf u (mapcan (lambda (x) (mapcar (lambda (y) (list x y)) '((1 (X 1)) (1 (Y 1))) )) '((1 (X 1)) (1 (Y 1))))) answer: (((1 (X 1)) (1 (X 1))) ...
- Wed Jan 05, 2011 12:13 pm
- Forum: Common Lisp
- Topic: Cartesian product of 2 lists which is NOT dependent
- Replies: 8
- Views: 16057
Cartesian product of 2 lists which is NOT dependent
Hi there everyone. I am using a function which calculates the cartesian product of 2 lists. (defun cartesian-product (list1 list2) "Return a list of the Cartesian product of two lists." (mapcan (lambda (x) (mapcar (lambda (y) (list x y)) list2)) list1)) This works great if all i wanted was...
- Wed Jan 05, 2011 9:22 am
- Forum: Common Lisp
- Topic: Expressing an Append comman in Cons
- Replies: 2
- Views: 3276
Re: Expressing an Append comman in Cons
Cheers, thanks very much, that has helped.
- Mon Jan 03, 2011 9:24 am
- Forum: Common Lisp
- Topic: Expressing an Append comman in Cons
- Replies: 2
- Views: 3276
Expressing an Append comman in Cons
Hey everyone, Im completely new in the lisp world, and i was just doing some programming and would be very grateful to anyone who could help. In a program i am writing i have one particular line which uses append and takes values such as: (append '((1 (X 1) (X 1)) (1 (X 1) (Y 1))) '((1 (X 1) (X 1)) ...