Skip to content

Instantly share code, notes, and snippets.

@aj07mm
Created March 31, 2020 21:02
Show Gist options
  • Save aj07mm/019e072125cdc8a06410cd30711e55da to your computer and use it in GitHub Desktop.
Save aj07mm/019e072125cdc8a06410cd30711e55da to your computer and use it in GitHub Desktop.
transducer.clj
(defn transducer [rf]
(fn
([] (rf))
([result] (rf result))
([result input] (rf result input))))
(defn transducer [rf] # rf eh +
(fn
([result] (rf result 0))
([result input] (rf result input))))
(transduce transducer + 0 [1 2 3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment