aleph

karlis 2017-11-10T14:26:33.000222Z

Hi all! This is more of a manifold question, but I'll ask this here: are there easy ways to transform a deferred to a core.async promise channel? after quick read through docs all interfacing with core.async happens through streams.

dm3 2017-11-10T16:35:37.000518Z

I think you have to go through streams or create something yourself, like:

(defn deferred->chan [d] (let [c (async/chan)] (d/on-realized d #(async/put! c [:value %]) #(async/put! c [:error %])) c))

mpenet 2017-11-10T16:40:47.000448Z

you can use an async/promise-chan for extra points

mpenet 2017-11-10T16:40:55.000302Z

saves some resources too