Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

Clojure reducers is the only parallel construct that does not support binding conveyance.

`
(def ^:dynamic bar "In main thread.")

(binding [bar "In reducers Thread."]

     (r/fold (fn [& args]
               bar) (vec (range 100000))))

=> "In main thread."
`

You have to manually use bound-fn:

`
(binding [bar "In reducers Thread."]

     (r/fold (bound-fn [& args]
                       bar) (vec (range 100000))))

=> "In reducers Thread."
`

I propose it is enhanced to behave the same as pmap, future, agents and core.async.

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2214 (reported by alex+import)
...