This comment has been minimized.
This comment has been minimized.Show comment Hide comment
nice, just one comment, this implementation has one issue, that is when you close the
(defn debounce [in ms] (let [out (chan)] (go-loop [last-val nil] (let [val (if (nil? last-val) (<! in) last-val) timer (timeout ms) [new-val ch] (alts! [in timer])] (condp = ch timer (do (>! out val) (recur nil)) in (if new-val (recur new-val))))) out))