module Exercise_8 where import Data.List {-WETT-} -- first step is filtering zeros, then mapping each element to 1 or -1 depending on their sign, --then since all numbers are 1 and -1, im grouping every similar element, im dropping 1 cause -- the answer is always the length of the array - 1 , but if i just do length - 1 instead of dropping --then ill be getting -1 for empty list and for lit of zeros -- little story of how i came up with this solution is down shoefa :: (Num a, Ord a) => [a] -> Int shoefa =length . drop 1 . group . map signum . filter (/=0) {-TTEW-}