Skip to content

Instantly share code, notes, and snippets.

@sjl
Created January 24, 2011 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sjl/792680 to your computer and use it in GitHub Desktop.
Save sjl/792680 to your computer and use it in GitHub Desktop.
(defn personality-stddev
[faved mehed hated mean]
(let [points (concat (take faved (cycle [1]))
(take mehed (cycle [0.5]))
(take hated (cycle [0])))
squared (map #(expt (- % mean) 2) points)]
(sqrt (/ (apply + squared) (count squared)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment