Relative Content

Tag Archive for clojure

Filter into two different collections

(let [ truthys (filter #(filter-func %) coll) falsys (filter #(not filter-func %) coll)] This code traverves coll twice and applys filter-func twice to each element. I was wondering, is there a way to filter coll into both truthys and falsys in just one go? clojure 1 (let [{truhys true, falsys false} (group-by filter-func coll)] …) […]

Filter into two different collections

(let [ truthys (filter #(filter-func %) coll) falsys (filter #(not filter-func %) coll)] This code traverves coll twice and applys filter-func twice to each element. I was wondering, is there a way to filter coll into both truthys and falsys in just one go? clojure 1 (let [{truhys true, falsys false} (group-by filter-func coll)] …) […]