Clojure

Add binding conveyance to reducers.

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.8
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Approval:
    Triaged

Description

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.

Activity

There are no comments yet on this issue.

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated: