Skip to content

Instantly share code, notes, and snippets.

@viksit
Created August 24, 2010 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viksit/8feba443c12348f33eb7 to your computer and use it in GitHub Desktop.
Save viksit/8feba443c12348f33eb7 to your computer and use it in GitHub Desktop.
(let [dir (new File datadir)
file-list (vec (. dir (listFiles)))
ans (ref {})]
(for [i (range (count (take 1 file-list)))]
(let [curfile (. (nth file-list i) getAbsolutePath)
words (vec (deserialize curfile))
(dosync
(alter ans (merge-with + (reduce map-count +cnt-map+ words)]
(prn ans)))))
@wmorganjr
Copy link

@wmorganjr
Copy link

(->> (File. datadir)
     .listFiles
     (map deserialize)
     (map #(reduce map-count +cnt-map+ %))
     (apply merge-with +))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment