Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns retriver.core
- (:gen-class))
- (def text (slurp "text\\potato.txt" :encoding "UTF-8"))
- (def countries (re-seq #".+(?=[\n,\r])|.+" (slurp "text\\countries.txt" :encoding "UTF-8")))
- (def cities (re-seq #".+(?=[\n,\r])|.+" (slurp "text\\cities.txt" :encoding "UTF-8")))
- (defn count_match [string,file]
- (def c (count (re-seq (re-pattern string) file)))
- (when (> c 0) (format "%s : %d" string c))
- )
- (defn -main [& args]
- (println (remove nil? (pmap (fn [word](count_match word text)) countries)))
- (println (remove nil? (pmap (fn [word](count_match word text)) cities)))
- (println "The end")
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement