Created
February 11, 2012 16:01
-
-
Save bonipart/1801360 to your computer and use it in GitHub Desktop.
Problem 2 of 3, embed.ly challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--list of <p> tag depths | |
ps = [1,2,1,1,1,1,1,1,1,2,2,2,3,3,3,4,4,4,4,4,5,5,5,5,1,1,1,1,1,2,1,1,1,1,2,2,1,3,1] | |
--compute mean of data points | |
avg = x/y | |
where | |
x = sum ps | |
y = fromIntegral(length ps) | |
--computes difference of data point and mean, square the result | |
diffSq p = (p - avg)^2 | |
--computes the std divation by taking the average of diffSq results, then taking the sqrt | |
stdiv = sqrt(x/y) | |
where | |
x = sum (map diffSq ps) | |
y = fromIntegral(length ps) | |
main = putStrLn (show stdiv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment