Skip to content

Instantly share code, notes, and snippets.

@amalloy
amalloy / gist:848084
Created February 28, 2011 21:36 — forked from ray1729/gist:848069
;; not sure whether this is an improvement but I don't really like letfn
(defn keep-only
[n bucket-fn s]
((fn my-filter
[s seen]
(lazy-seq
(when (seq s)
(let [e (first s)
b (bucket-fn e)
c (inc (get seen b 0))]