core-async

2020-01-07T07:46:53.189300Z

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#)))

2020-01-07T07:57:21.189600Z

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!))))))

2020-01-07T08:13:25.192300Z

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

2020-01-07T08:13:36.192500Z

For use with core.async