Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (import 'java.io.File)
- (require '[clojure.zip :as zip])
- (defn branch? [f]
- (.isDirectory f))
- (defn children [f]
- (.listFiles f))
- (defn iterzip [z]
- "Iterate over a zip, returns a sequence of the nodes"
- (when (not (zip/end? z))
- (cons (zip/node z) (lazy-seq (iterzip (zip/next z))))))
- (defn iterdir [path]
- (iterzip (zip/zipper branch? children nil (File. path))))
Add Comment
Please, Sign In to add comment