Created
March 31, 2020 21:02
-
-
Save aj07mm/019e072125cdc8a06410cd30711e55da to your computer and use it in GitHub Desktop.
transducer.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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