(Please correct me if there's a better way to do this)
distinct currently only takes one argument, the sequence to filter. if you're filtering a single level seq that's fine, but if you can't filter any more interesting elements, for example...
[{:id 1 :value "foo"} {:id 2 :value "foo"} {:id 3 :value "bar"}]
i suggest adding a first parameter to extract the value from each element being compared.
(defn distinct
"Returns a lazy sequence of the elements identified by f of coll with duplicates removed"
{:added "1.0"
:static true}
([coll] (distinct identity coll))
([f coll]
(let [step (fn step [xs seen]
(lazy-seq
((fn [[vs :as xs] seen]
(let [v (f vs)]
(when-let [s (seq xs)]
(if (contains? seen v)
(recur (rest s) seen)
(cons vs (step (rest s) (conj seen v)))))))
xs seen)))]
(step coll #{}))))
Then allowing to use like...
(->> values
(distinct :value)
(map etc...))
Or is there a better way of doing this in core?