Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Tree pretty printer in clojure
(defn print-subtree [subtree prefix]
(if (empty? subtree)
(apply str prefix (first subtree) "\n"
(map #(print-subtree %1 (str "\t" prefix)) (rest subtree)))))
(defn print-tree [tree]
(print-subtree tree ""))
(deftest print-empty-tree
(is (= (print-tree

This comment has been minimized.

Copy link

@fatso83 fatso83 commented Apr 29, 2011

Ganske lik mitt forsøk på å skrive lisp i Java, men det ser litt mer elegant ut :-) (tabbedString3 versjonen)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.