Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save green-coder/5b962f443b193505a00f864784663f55 to your computer and use it in GitHub Desktop.
Save green-coder/5b962f443b193505a00f864784663f55 to your computer and use it in GitHub Desktop.
(defn debug
; Default parameters stuffs.
([] (debug 0))
([indent] (debug indent ">" "<"))
([indent in out]
(let [spaces (apply str (repeat indent \space))]
(debug (str spaces in)
(str spaces out))))
; The transducer code starts here.
([in out]
(fn [rf]
(fn ([] (rf))
([result] (rf result))
([result input]
(print in input \return)
(let [ret (rf result input)]
(print out ret \return)
ret))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment