On May 23, 9:21 pm, Michael Gardner <gardne...@gmail.com> wrote:
> I need to use a predicate to divide one list into two, one containing all 
> values for which the predicate is true, and the other with all remaining 
> values. I can do this easily by filtering twice, once with the predicate and 
> once with its complement, but is there some core or contrib function that 
> will do this more directly and efficiently? I'm not sure what the best way to 
> search for something like this would be.

AFAIK there's nothing clojure.core that does this, but
clojure.contrib.seq-utils - 
http://richhickey.github.com/clojure-contrib/branch-1.1.x/seq-utils-api.html
- has group-by:

user> (use 'clojure.contrib.seq-utils)
nil
user> (group-by even? [1 2 3 4 5 6])
{false [1 3 5], true [2 4 6]}

-- 
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