module Exercise_8 where import Data.List (group, intercalate, maximumBy) import Data.Ord (comparing) import Control.Arrow ((***), first) {-WETT-} shoefa :: (Num a, Ord a) => [a] -> Int shoefa = length . drop 1 . group . map signum . filter (/= 0) -- & that's why I like the way 'group' works in Haskell. -- 'drop 1' should be a safe 'tail' without exceptions, -- unfortunately I could not find a predefined equivalent -- method in the allowed packages. {-TTEW-}