Skip to content

Instantly share code, notes, and snippets.

@ithayer
Created February 13, 2013 19:59

Revisions

  1. ithayer created this gist Feb 13, 2013.
    10 changes: 10 additions & 0 deletions babbage-simple.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    ;; All the visitors to my site.
    #> (->> (all-visitors) count)
    1000
    ;; Which browsers?
    #> (->> (all-visitors) (map :browser) frequencies)
    {:ie-10 50 :ie-9 250 :ie-8 200 :firefox 140 :chrome 360}
    ;; Average spend?
    #> (let [spent (->> (all-visitors) (keep :spend))]
    (/ (reduce + spent) (count spent)))
    123.12