Fork me on GitHub
#core-async
<
2021-04-16
>
Jakub Holý07:04:29

A while back, with the kind help of this channel, I have created catching-transduce , which is similar to transduce but checks for Throwable in the input channel and catches exceptions during the transformation / reduction step and returns the exception if any. Feedback welcome. https://gist.github.com/holyjak/61d89610e488f31d8c53b8bbbad299c1 I have to admit it was a real struggle to make sure that it never hangs....

Milan Munzar19:04:01

I find that it is a bit of unfortunate that as/pipe returns it's to channel. Would be nice if it had the same semantics like pipeline function which allows it to be awaited for when the pipeline is done.

Jan K19:04:11

I agree, luckily it's easy to define your own pipe by copying the original https://github.com/clojure/core.async/blob/v0.2.395/src/main/clojure/clojure/core/async.clj#L460

Milan Munzar19:04:31

even better you can do:

(as/pipeline 1 o-chan (map identity) i-chan)

jjttjj20:04:02

Personally I use pipe more often for ongoing processes and do take advantage of the fact that it returns a channel somewhat frequently