Skip to content

Instantly share code, notes, and snippets.

@michalmarczyk
Forked from anonymous/gist:408610
Created May 21, 2010 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michalmarczyk/408622 to your computer and use it in GitHub Desktop.
Save michalmarczyk/408622 to your computer and use it in GitHub Desktop.
(def file-info-extractors
{:filename #(.getName #^java.io.File %)
:path #(str (.toURI #^java.io.File %))
:modified #(.lastModified #^java.io.File %)})
(map #(reduce (fn [m [k e]]
(assoc m k (e %)))
{}
file-info-extractors)
(.listFiles (java.io.File. ".")))
;;; or...
(map (comp (partial zipmap [:filename :path :modified])
(juxt #(.getName %) #(str (.toURI %)) #(.lastModified %)))
(.listFiles (java.io.File. ".")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment