Skip to content

Instantly share code, notes, and snippets.

@AlexBaranosky
Created January 28, 2014 08:31
Show Gist options
  • Save AlexBaranosky/8664021 to your computer and use it in GitHub Desktop.
Save AlexBaranosky/8664021 to your computer and use it in GitHub Desktop.
(require '[clojure.java.io :as io]
'[incanter.stats :as stats])
(import '[cern.colt.list.tdouble DoubleArrayList])
(defn rpt [xs]
(mapv vector
["Min" "10%" "20%" "30%" "40%" "50%"
"60%" "70%" "80%" "90%" "99%" "99.5%" "99.9%" "Max"]
(stats/quantile xs
:probs (DoubleArrayList.
(double-array
[0.0 0.1 0.2 0.3 0.4 0.5
0.6 0.7 0.8 0.9 0.95 0.99 0.999 1.0])))))
;;(rpt [1 2 3 4 5 6 7 8 9])
(defn f2 [file]
(->> file
io/reader
line-seq
(map #(Integer/parseInt %))
rpt))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment