Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
(defn stateful-std-deviation[x]
|
||||
(letfn [(std-dev[x]
|
||||
(let [v (deref (find-var (symbol (str *ns* "/v"))))]
|
||||
(swap! v conj x)
|
||||
(let [m (/ (reduce + @v) (count @v))]
|
||||
(Math/sqrt (/ (reduce + (map #(* (- m %) (- m %)) @v)) (count @v))))))]
|
||||
(when (nil? (resolve 'v))
|
||||
(intern *ns* 'v (atom [])))
|
||||
(std-dev x)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue