Cumulative standard deviation: Difference between revisions
Content added Content deleted
(→[[Standard_Deviation#ALGOL 68]]: A simple - but "unpackaged" - code example) |
No edit summary |
||
Line 315: | Line 315: | ||
return 0 ; |
return 0 ; |
||
}</lang> |
}</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}}== |
=={{header|Common Lisp}}== |