Anonymous user
Cumulative standard deviation: Difference between revisions
no edit summary
(→[[Standard_Deviation#ALGOL 68]]: A simple - but "unpackaged" - code example) |
No edit summary |
||
Line 315:
return 0 ;
}</lang>
=={{header|Clojure}}==
<lang lisp>
(defn std-dev [samples]
(let [n (count samples)
mean (/ (reduce + samples) n)
intermediate (map #(Math/pow (- %1 mean) 2) samples)]
(Math/sqrt
(/ (reduce + intermediate) n))))
(println (std-dev [2 4 4 4 5 5 7 9])) ;;2.0
</lang>
=={{header|Common Lisp}}==
|