Fork me on GitHub
#core-async
<
2020-01-07
>
didibus07:01:53

Well, for anyone interested, my solution was this macro:

(defmacro forcatv [[element-sym coll] & body]
  `(loop [acc# [] coll# ~coll]
     (if-let [~element-sym (first coll#)]
       (recur (into acc# (do ~@body)) (next coll#))
       acc#)))

didibus07:01:21

That allows me to mapcat in a way that the go macro is able to rewrite my mapcat as well, since there is no longer a function boundary. So now I can do:

(async/<!!
 (async/go
   (forcatv [e [1 2 3]]
            (async/<!
             (doto (async/chan)
               (async/put! [e])
               (async/close!))))))

didibus08:01:25

Which got me curious, anyone knows of a library that provides not boundary crossing variants of most sequence functions?

didibus08:01:36

For use with core.async