Jan 14, 2004 #1 T tsigwing Usenet Archive Joined Jun 26, 2003 Messages 76 Reaction score 0 I know there has to be a simple way to subtract the contents of one list from another. Any help?
Jan 14, 2004 #2 L Luis Esquivel Usenet Archive Joined Jun 12, 2002 Messages 266 Reaction score 0 any practical sample that i can take a look - to test.? tsigwing said: I know there has to be a simple way to subtract the contents of one list Click to expand... from another. Any help?
any practical sample that i can take a look - to test.? tsigwing said: I know there has to be a simple way to subtract the contents of one list Click to expand... from another. Any help?
Jan 14, 2004 #3 M michael puckett Usenet Archive Joined Mar 10, 2000 Messages 306 Reaction score 0 Responding to keyword "simple", and a fuzzy understanding what you mean "contents of one list from another" ... (setq list1 '(1 2 3 4 5) list2 '(2 3 4) ) (vl-remove-if '(lambda (x) (member x list2)) list1 ) returns (1 5) I know there has to be a simple way to subtract the contents of one list from another. Any help?
Responding to keyword "simple", and a fuzzy understanding what you mean "contents of one list from another" ... (setq list1 '(1 2 3 4 5) list2 '(2 3 4) ) (vl-remove-if '(lambda (x) (member x list2)) list1 ) returns (1 5) I know there has to be a simple way to subtract the contents of one list from another. Any help?
Jan 14, 2004 #4 T Troy Usenet Archive Joined Jan 25, 2003 Messages 5 Reaction score 0 That's it. Thanks.
Dec 28, 2004 #5 A Adesu Usenet Archive Joined Aug 11, 2003 Messages 537 Reaction score 0 Hi michael puckett , how about this below I would "(- list1 list2)" _$ (setq list1 '(1.9 2.8 3.7 4.8 5.7)) (1.9 2.8 3.7 4.8 5.7) _$ (setq list2 '(1.1 2.2 3.3 4.1 5.5)) (1.1 2.2 3.3 4.1 5.5)
Hi michael puckett , how about this below I would "(- list1 list2)" _$ (setq list1 '(1.9 2.8 3.7 4.8 5.7)) (1.9 2.8 3.7 4.8 5.7) _$ (setq list2 '(1.1 2.2 3.3 4.1 5.5)) (1.1 2.2 3.3 4.1 5.5)
Dec 28, 2004 #6 R R. Robert Bell Usenet Archive Joined Jul 7, 2003 Messages 890 Reaction score 0 _$ (mapcar '- list1 list2) (0.8 0.6 0.4 0.7 0.2)
Dec 29, 2004 #7 A Adesu Usenet Archive Joined Aug 11, 2003 Messages 537 Reaction score 0 Perfect ! ,thanks Bell R. Robert Bell said: _$ (mapcar '- list1 list2) (0.8 0.6 0.4 0.7 0.2) Click to expand...
Perfect ! ,thanks Bell R. Robert Bell said: _$ (mapcar '- list1 list2) (0.8 0.6 0.4 0.7 0.2) Click to expand...
Dec 30, 2004 #8 W wkiernan Usenet Archive Joined Jan 30, 2004 Messages 19 Reaction score 0 Or, alternatively, (setq list_c nil) (foreach el list_a (or (member el list_b)(setq list_c (cons el list_c))) )
Or, alternatively, (setq list_c nil) (foreach el list_a (or (member el list_b)(setq list_c (cons el list_c))) )
Dec 30, 2004 #9 A Adesu Usenet Archive Joined Aug 11, 2003 Messages 537 Reaction score 0 ????????????????????? _ (setq list_a '(1.9 2.8 3.7 4.8 5.7)) (1.9 2.8 3.7 4.8 5.7) _$ (setq list_b '(1.1 2.2 3.3 4.1 5.5)) (1.1 2.2 3.3 4.1 5.5) _$ (setq list_c nil) nil _$ (foreach el list_a (or (member el list_b)(setq list_c (cons el list_c)))) T
????????????????????? _ (setq list_a '(1.9 2.8 3.7 4.8 5.7)) (1.9 2.8 3.7 4.8 5.7) _$ (setq list_b '(1.1 2.2 3.3 4.1 5.5)) (1.1 2.2 3.3 4.1 5.5) _$ (setq list_c nil) nil _$ (foreach el list_a (or (member el list_b)(setq list_c (cons el list_c)))) T
Dec 31, 2004 #10 W wkiernan Usenet Archive Joined Jan 30, 2004 Messages 19 Reaction score 0 the expression itself returns T (that's the return value of or) but look at the value of list_c.