Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.async by

Can we get a generic sink operation?

`
(defn sink
"Fully consumes and discards a channel, applying f to each val. Returns a channel that
closes when ch is fully drained"
[f ch]
(go-loop []
(when-some [v (<! ch))]</p>

 (f v)
 (recur))))

`

2 Answers

0 votes
by

Comment made by: glts

I cast my vote and want to remark that perhaps the lack of this 'sink operation' can be felt more acutely since the introduction of run! in 1.7, a sink for seqs.

0 votes
by
Reference: https://clojure.atlassian.net/browse/ASYNC-67 (reported by gshayban)
...