Clojure Transducer relationship to automatons

Is there any relationship between Clojure’s Transducers and Transducers from Automata Theory?
Or are they completely different?

A transducer in Clojure is a “reducing function transformer”, i.e., a higher-order function that accepts a reducing function and returns a new reducing function.(map inc) is a transducer, and you could apply it to a reducing function like conj to produce a new reducing function that adds one to items as they are conj’d into a collection:

(def inc-tf (map inc))
(def conj-inc (inc-tf conj))
(reduce conj-inc [] (range 5)) ;=> [1 2 3 4 5]
;; this pattern is common enough that we have a shorthand function:
(transduce (map inc) conj [] (range 5)) ;=> [1 2 3 4 5]

A transducer in automata theory is a transformation process from input to output, so they operate at different abstraction levels.

TL;DR: they are very different.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.