Advertisement
Guest User

retriver

a guest
Aug 29th, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (ns retriver.core
  2.   (:gen-class))
  3.  
  4. (def text (slurp "text\\potato.txt" :encoding "UTF-8"))
  5. (def countries (re-seq #".+(?=[\n,\r])|.+" (slurp "text\\countries.txt" :encoding "UTF-8")))
  6. (def cities (re-seq #".+(?=[\n,\r])|.+" (slurp "text\\cities.txt" :encoding "UTF-8")))
  7.  
  8.  
  9. (defn count_match [string,file]
  10.   (def c (count (re-seq (re-pattern string) file)))
  11.   (when (> c 0) (format "%s : %d" string c))
  12.   )
  13.  
  14. (defn -main [& args]
  15.   (println (remove nil? (pmap (fn [word](count_match word text)) countries)))
  16.   (println (remove nil? (pmap (fn [word](count_match word text)) cities)))
  17.   (println "The end")
  18.   )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement