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

1 Example top

  • user=> (separate even? [1 2 3 4 5 6 7])
    [(2 4 6) (1 3 5 7)]
    
    user=> (let [[big small] (separate #(> % 100) [1 200 50 765 1287])]
               (println "big:" big)
               (println "small:" small))
    big: (200 765 1287)
    small: (1 50)
    nil
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/seq_utils.clj:49 top

(defn separate
  "Returns a vector:
   [ (filter f s), (filter (complement f) s) ]"
  [f s]
  [(filter f s) (filter (complement f) s)])
Vars in clojure.contrib.seq-utils/separate: defn
Used in 0 other vars

Comments top

No comments for separate. Log in to add a comment.