Skip to content

Instantly share code, notes, and snippets.

@ithayer
Last active December 13, 2015 18:29
Show Gist options
  • Save ithayer/4956169 to your computer and use it in GitHub Desktop.
Save ithayer/4956169 to your computer and use it in GitHub Desktop.
;; Simple mean function.
#> (defn compute-mean [xs] (/ (reduce + xs) (count xs)))
;; Check the average spend for firefox.
#> (->> (all-visitors)
(filter #(-> % :browser (= :firefox)))
(keep :spend)
compute-mean)
100.2
;; And now for chrome.
#> (->> (all-visitors)
(filter #(-> % :browser (= :chrome)))
(keep :spend)
compute-mean)
112.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment