core.async

Can we get a generic sink operation?

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Approval:
    Triaged

Description

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))]
     (f v)
     (recur))))

Activity

Hide
David Bürgin added a comment -

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.

Show
David Bürgin added a comment - 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.

People

Vote (3)
Watch (0)

Dates

  • Created:
    Updated: