Re: subtractng sequence?

2009-06-03 Thread kyle smith
How about (map - seq1 seq2) ? An example or two of the desired output would be helpful. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com

Re: subtractng sequence?

2009-06-03 Thread Wilson MacGyver
Christophe's solution seems to work. basically I just wanted to remove (4 6 8 10) from (2 3 4 5 6 7 8 9 10) so I end up with (2 3 5 7 9) On Wed, Jun 3, 2009 at 3:27 AM, kyle smith the1physic...@gmail.com wrote: How about (map - seq1 seq2) ? An example or two of the desired output would be

Re: subtractng sequence?

2009-06-03 Thread Laurent PETIT
If what you really want to do is treat those sequences as sets, then you can use clojure.seq/difference: 1:1 user= (def seq1 (list 2 3 4 5 6 7 8 9 10)) #'user/seq1 1:2 user= (def seq2 (list 4 6 8 10)) #'user/seq2 1:3 user= (require 'clojure.set) nil 1:4 user= (clojure.set/difference (set seq1)

Re: subtractng sequence?

2009-06-03 Thread Wilson MacGyver
ah, that works too! thanks! On Wed, Jun 3, 2009 at 3:48 AM, Laurent PETIT laurent.pe...@gmail.com wrote: If what you really want to do is treat those sequences as sets, then you can use clojure.seq/difference: 1:1 user= (def seq1 (list 2 3 4 5 6 7 8 9 10)) #'user/seq1 1:2 user= (def seq2

Re: subtractng sequence?

2009-06-03 Thread Daniel Lyons
On Jun 2, 2009, at 11:22 PM, Wilson MacGyver wrote: More newbie questions. :) If I have two sequences as follow: (2 3 4 5 6 7 8 9 10) (4 6 8 10) what's the best way to subtract the 2nd sequence from the first one? The best I can come up with was to do (first) on 2nd sequence and

Re: subtractng sequence?

2009-06-03 Thread Wilson MacGyver
Thank you for such a detail email on the algorithm. I'll certainly keep that in mind. This is so far been the most impressive thing I've found about clojure. the community is very friendly and helpful. You've made a newbie feel much more comfortable. On Wed, Jun 3, 2009 at 12:33 PM, Daniel

subtractng sequence?

2009-06-02 Thread Wilson MacGyver
More newbie questions. :) If I have two sequences as follow: (2 3 4 5 6 7 8 9 10) (4 6 8 10) what's the best way to subtract the 2nd sequence from the first one? The best I can come up with was to do (first) on 2nd sequence and turn around and do a (remove) on the first sequence, etc until I

Re: subtractng sequence?

2009-06-02 Thread Christophe Grand
Wilson MacGyver a écrit : More newbie questions. :) If I have two sequences as follow: (2 3 4 5 6 7 8 9 10) (4 6 8 10) what's the best way to subtract the 2nd sequence from the first one? Is the order of the second sequence important? If not: (defn subtract [a b] (remove (into #{}