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) (set seq2))
#{2 3 5 7 9}
1:5 user=> (seq (clojure.set/difference (set seq1) (set seq2)))
(2 3 5 7 9)
1:7 user=>


2009/6/3 Wilson MacGyver <wmacgy...@gmail.com>:
>
> 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 exhaust the 2nd sequence.
>
> is there a better way?
>
> Thanks,
>
> --
> Omnem crede diem tibi diluxisse supremum.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to