Jump to content

Cumulative standard deviation: Difference between revisions

m
m (→‎only show standard deviation: aligned statements.)
Line 459:
=={{header|AppleScript}}==
 
Accumulation acrossover a fold:
 
<lang AppleScript>-------------- stdDevIncCUMULATIVE ::STANDARD AccumulatorDEVIATION -> Num -> Index -> Accumulator----------
 
-- stdDevInc :: Accumulator -> Num -> Index -> Accumulator
-- stdDevInc :: {sum:, squaresSum:, stages:} -> Real -> Integer
-- -> {sum:, squaresSum:, stages:}
Line 474 ⟶ 476:
 
 
--------------------------- TEST -------------------------
-- TEST
on run
set lstSamplexs to [2, 4, 4, 4, 5, 5, 7, 9]
stages of foldl(stdDevInc, ¬
{sum:0, squaresSum:0, stages:[]}, lstSamplexs)
--> {0.0, 1.0, 0.942809041582, 0.866025403784, 0.979795897113, 1.0, 1.399708424448, 2.0}
Line 486 ⟶ 488:
 
 
-- GENERIC FUNCTIONS --------------------------------------------------- GENERIC FUNCTIONS -------------------
 
-- foldl :: (a -> b -> a) -> a -> [b] -> a
Line 499 ⟶ 501:
end tell
end foldl
 
 
-- Lift 2nd class handler function into 1st class script wrapper
9,655

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.