jlongster / transducers.js

A small library for generalized transformation of data (inspired by Clojure's transducers)
BSD 2-Clause "Simplified" License
1.72k stars 54 forks source link

transformation context #27

Open tchak opened 9 years ago

tchak commented 9 years ago

Transducers are all about compose and reuse :) The fact that we have to define context on the transform makes them less reusable. Could we find a way to execute a composition of transforms with a given context ? Like a ctx argument on transduce method ?

jlongster commented 9 years ago

The ctx variable in each transform is mostly there when you use the transforms directly like map([1, 2, 3], function() {}, context). You are right that transduce should take a context.