Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (44 sloc) 1.32 KB
(ns stammtisch.core
(:use [stammtisch.meikel-version][stammtisch.common-functions])
[criterium.core :as cr])
; Usage:
; load this namespace ( (use 'stammtisch.core) ) and then type either one of these lines
; (-main "moby-dic.txt" "vanilla")
; (-main "moby-dic.txt" "meikel")
; (-main "moby-dic.txt" "vanilla" "-b")
; (-main "moby-dic.txt" "meikel" "-b")
(defn lines-in-the-file [file-reader]
(line-seq file-reader)
(defn vanilla-words [coll-of-lines]
(mapcat words-per-line coll-of-lines)
(defn vanilla-process-my-file [path-to-the-file]
(with-open [mio-file ( path-to-the-file)]
(sort-by second > (frequencies (vanilla-words (lines-in-the-file mio-file)))
(defn set-up [version path-to-the-file]
(case version
(vanilla-process-my-file path-to-the-file)
(meikel-process-my-file path-to-the-file)
(defn print-it [version path-to-file]
(let [to-be-printed (take 10 (set-up version path-to-file))]
(dorun (map #(println %) to-be-printed )) )
(defn -main [path-to-file version & args]
(let [benchmarking (first args)]
(if (= benchmarking "-b")
(cr/quick-bench (print-it version path-to-file) :verbose)
(print-it version path-to-file)