On Dec 25, 4:58 pm, Mibu <mibu.cloj...@gmail.com> wrote:
> My version:
>
> (defn top-words [input-filename result-filename]
>   (spit result-filename
>         (apply str
>                (map #(format "%s : %d\n" (first %) (second %))
>                     (sort-by #(-(val %))
>                              (reduce #(conj %1 { %2 (inc (%1 %2 0)) }) {}
>                                      (map #(.toLowerCase %)
>                                           (re-seq #"\w+"
>                                                   (slurp 
> input-filename)))))))))
>
> Mibu

Once you move .toLowerCase right after slurp, it gets 3 times faster.


regards,
Piotrek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to