Uploaded image for project: 'Clojure'
  1. CLJ-2214

Add binding conveyance to reducers.

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: Release 1.8
    • Fix versions: 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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: