eve / src / eve / core.clj

(ns eve.core
  (:use [incanter core io charts stats]))

(def world-population
  (read-dataset "https://raw.github.com/gist/2394233/42b9139fe59bf6aac1e17cffb719e4796792225e/world-population.csv"
                :header true))

(defn number-of-ancestors [x]
  (let [years-ago (- 2012 x)
        generations-ago (int (/ years-ago 20))]
    (Math/pow 2 generations-ago)))

(doto (scatter-plot ($ :year world-population)
                    ($ :population world-population)
                    :x-label "Year"
                    :y-label "People")
  (add-function number-of-ancestors 500 2012)
  (set-x-range 500 2012)
  (set-y-range 0 1300000000)

(defn get-account-type [cash]
    (< cash 1000)  :normal
    (< cash 10000) :silver
    :else          :gold))

(time (dotimes [_ 1000] (get-account-type (rand 20000)))) 
(time (dotimes [_ 1000] (get-account-type (rand 20000)))) 
(time (dotimes [_ 1000] (get-account-type (rand 20000)))) 
(dotimes [_ 1000000] (get-account-type (rand 20000)))
(time (dotimes [_ 1000] (get-account-type (rand 20000)))) 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.