Skip to content

Instantly share code, notes, and snippets.

@jstaffans
Last active February 3, 2016 08:59
Show Gist options
  • Save jstaffans/2ee69ef6cf99a5fa58bb to your computer and use it in GitHub Desktop.
Save jstaffans/2ee69ef6cf99a5fa58bb to your computer and use it in GitHub Desktop.
Clojure's transducers

Transducers in Clojure

Some notes for myself.

  • Single-threaded concept, no inherent parallelism (as opposed to reducers)
  • Key benefits: function composition, better performance by way of removing need for creation of intermediary collections
  • Parallelism can be introduced by:
    • Using core.async pipelines + transducers
    • using r/fold (see comments here)
  • For heavy, parallel data crunching, reducers will still probably be faster
  • But transducers are a nicer overall concepts that fits better with the rest of Clojure
  • Transducers have no inherent concept of laziness - they can be used to produce lazy sequences

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment