Cumulative standard deviation: Difference between revisions
m
→{{header|AppleScript}}: Tidying
m (→only show standard deviation: aligned statements.) |
m (→{{header|AppleScript}}: Tidying) |
||
Line 459:
=={{header|AppleScript}}==
Accumulation
<lang AppleScript>--------------
-- stdDevInc :: Accumulator -> Num -> Index -> Accumulator
-- stdDevInc :: {sum:, squaresSum:, stages:} -> Real -> Integer
-- -> {sum:, squaresSum:, stages:}
Line 474 ⟶ 476:
--------------------------- TEST -------------------------
on run
set
stages of foldl(stdDevInc, ¬
{sum:0, squaresSum:0, stages:[]},
--> {0.0, 1.0, 0.942809041582, 0.866025403784, 0.979795897113, 1.0, 1.399708424448, 2.0}
Line 486 ⟶ 488:
-- foldl :: (a -> b -> a) -> a -> [b] -> a
Line 499 ⟶ 501:
end tell
end foldl
-- Lift 2nd class handler function into 1st class script wrapper
|