Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def intree (zip/vector-zip [["Pictures" [["Photos"] ["Other"]]] ["Downloads"]]))
- (defn tree-to-html [tree]
- (loop [loc tree]
- (if (zip/end? loc)
- (zip/root loc)
- (recur (zip/next
- (if-not (zip/left loc)
- (zip/insert-left loc (if (zip/branch? loc) :ul :li))
- loc))))))
- (tree-to-html intree)
- ;; [:ul [:li "Pictures" [:ul [:li "Photos"] [:li "Other"]]] [:li "Downloads"]]
Advertisement
Add Comment
Please, Sign In to add comment