Fork me on GitHub
#core-async
<
2017-09-24
>
yury.solovyov18:09:09

I found myself writing code like this several times:

(defn watch-scan-progress [panel progress]
  (async/go-loop [value (async/<! progress)]
    (dispatch [:update-scan-progress panel value])
    (recur (async/<! progress))))

yury.solovyov18:09:06

where the only difference is in code between getting value from channel and recuring to it again

yury.solovyov18:09:41

I was thinking if I can generalize that into a function or something, but I had a problem with go macro not allowing that

yury.solovyov19:09:53

what I think I want is a general function or macro to say something like (watch-chan progress-channel (fn [val] (foo val))) or something along these lines