module Functions where map' f [] = [] map' f (t:u:v:w:x:y:z:xs) = f t u v w x y z:map' f xs operation a b c d e f g = do r <- (out [a,b,c,d,e,f]) if (r == g) then return r else return (abs (r-g)) control xs | (mod (length xs) 7) == 0 = map' operation' xs | otherwise = error "Incorrect size of vector" -- FUNCTION 'OUT' out [a, b, c, d, e, f] = [ divicao [divicao [soma [resta [soma [a,b], c], d], e], f] ] -- FUNCTION DECLARATION soma :: [Float] -> Float soma [x, y] = x + y resta :: [Float] -> Float resta [x, y] = x - y divicao :: [Float] -> Float divicao [a, b] | b == 0 = error "Division by zero" | otherwise = a / b operation' a b c d e f g = out [a,b,c,d,e,f]