Commits

Miki Tebeka  committed f3a48e8

Use sum from incanter and thanks -> thanked

  • Participants
  • Parent commits 73f8317

Comments (0)

Files changed (1)

File src/clj2010.clj

   (:use [clj-time.core :only (date-time plus minutes year month day)]
         [clj-time.coerce :only (to-long)]
         [clj-time.format :only (formatter unparse)]
-        [incanter.core :only (save)]
+        [incanter.core :only (save sum)]
         [incanter.charts :only (bar-chart)]
         [clojure.java.io :only (reader)]
         [clojure.contrib.string :only (trim lower-case split)])
   (fn [dt]
     (unparse (formatter fmt) dt)))
 
-(defn sum [values]
-  (reduce + values))
-
 (defn load-stop-words []
   (set (line-seq (reader "stop-words.txt"))))
 
   (and (re-find #"(?i)thank" text)
        (re-find #"[a-zA-Z0-9_-`'|]+:" text)))
 
-(def thanks {
+(def thanked {
   :map (fn [record]
              (if-let [user (get-thanked (:text record))]
                [[(fix-user user) 1]]
   :reduce (fn [key values] (sum values))
   :text true
   :max 100
-  :outfile "thanks"})
+  :outfile "thanked"})
 
-(def *jobs* [numlines numusers active words])
+(def *jobs* [
+  numlines 
+  numusers 
+  active
+  words 
+  thanked
+])
 
 (defn -main []
   (let [records (load-data "logs")