Guest User

Untitled

a guest
Sep 22nd, 2010
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.40 KB | None | 0 0
  1. (def intree (zip/vector-zip [["Pictures" [["Photos"] ["Other"]]] ["Downloads"]]))
  2.  
  3. (defn tree-to-html [tree]
  4.   (loop [loc tree]
  5.     (if (zip/end? loc)
  6.       (zip/root loc)
  7.       (recur (zip/next
  8.           (if-not (zip/left loc)
  9.         (zip/insert-left loc (if (zip/branch? loc) :ul :li))
  10.         loc))))))
  11.  
  12. (tree-to-html intree)
  13.  
  14. ;; [:ul [:li "Pictures" [:ul [:li "Photos"] [:li "Other"]]] [:li "Downloads"]]
Advertisement
Add Comment
Please, Sign In to add comment