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
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
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)
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
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
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
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
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 #{}