Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defn print-expr [expr]
(walk/postwalk
(fn algebra [e]
(cond
(cst? e) (str e)
(sym? e) e
(add? e) (str "(+ " (string/join " " (rest e)) ")")
(mul? e) (str "(* " (string/join " " (rest e)) ")")
:else e))
expr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment