Fork me on GitHub
#core-async
<
2016-02-10
>
andrewboltachev21:02:25

Hi. Having a standard (go-loop [] (let [v (<! ch)] ...processing the value...)), is it possible to "cancel" body of the loop in a way not unlike cancelling AJAX request in the Web?

ghadi21:02:11

as in while ...processing the value....?

ghadi21:02:45

not unless you build in an explicit point where you can listen for an external signal (using a cancellation channel)

andrewboltachev21:02:03

I should add: "when a new data arrives" (to the channel)

ghadi21:02:56

I see. Yes. Launch/dispatch the processing elsewhere using a function that returns a channel with the result value... then use alts! to wait for either that channel or the original input channel

ghadi21:02:19

hand-wavey, but that's the general approach

andrewboltachev21:02:24

Thanks! I wonder if some standard feature would help me with this. I'll check out alts! func and it's siblings then