Skip to content

The art of writing a transducer

Christophe Grand edited this page Sep 4, 2015 · 2 revisions

There are some rules to follow when writing a transducer (rf is supposed to be the reducing function passed as argument to the transducer):

  1. The 0-arity of the returned reducing fn MUST be only be (rf). No initialization there because some transducing contexts never call this arity. All initialization must be done when the transducer is invoked.

  2. When calling the 2-arity of rf, always check for reduced? (unless no further computation on the returned value is done).