Yes it is indeed cool but it suffers from the same problem as the juxt version (as Tassillo mentioned)...they are both very elegant and succinct but unfortunately slow for large sequences. The group-by version and the doseq version are way faster...also, there is a reducer-based filter if you want go parallel...

you asked where to find this funciton... a couple of places actually :)
http://clojuredocs.org/clojure_contrib/clojure.contrib.seq-utils/separate
http://richhickey.github.com/clojure-contrib/seq-utils-api.html

HTH,

Jim



On 04/04/13 19:12, Christian Romney wrote:
On Thursday, April 4, 2013 12:13:13 PM UTC-4, Jim foo.bar wrote:

    there is a separate fn in contrib and does exactly what you want
    (assuming you don't care about the 2 passes):

    (defn separate
    "Returns a vector:
    [ (filter f s), (filter (complement f) s) ]"
    [f s]
    [(filter f s) (filter (complement f) s)])


Very cool—where can I find this? I ask because there may be other goodies I should be aware of... I also like Tassilo's version using juxt. It's great to see the same problem solved different ways.

--
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to