import System.Environment
import Prelude hiding (abs, head, null, foldr)
import Tutorial hiding (main)
increment x = x + 1
sgn x
| x < 0 = -1
| x > 0 = 1
| otherwise = 0
isSingleton (_:_) = True
isSingleton _ = False
fromTo n m
| n > m = []
| otherwise = n : fromTo (increment n) m
append [] ys = ys
append (x:xs) ys = x : (append xs ys)
filterList _ [] = []
filterList p (x:xs)
| p x = x : filterList p xs
| otherwise = filterList p xs
andList xs = foldr (&&) True xs
g :: (a -> b) -> a -> [b] -> [b]
g f x xs = f x : xs
mapList :: (a -> b) -> [a] -> [b]
mapList f xs = foldr (g f) [] xs
listLength [] = 0
listLength (x:xs) = 1 + listLength xs
curry :: ((a, b) -> c) -> a -> b -> c
curry f = \x y -> f (x,y)
infixr 9 >>>
(>>>) :: (a -> b) -> (b -> c) -> (a -> c)
f >>> g = \x -> g (f x)
squareRoot a = head (dropWhile (\x -> abs (x * x - a) > eps) (iterate (\x -> (x + a / x) / 2) a))
where eps = 0.001
main = do
args <- getArgs
if (not (null args))
then do
let xs = [ read x | x <- args ]
print (averageDeviation xs)
else do
print "No parameters specified."