blob: 3c2297460269ab22b8f0d0cabf0b73b935c3e80f [file]
module List where
butlast :: [a] -> [a]
butlast [] = []
butlast (x:xs) = if null xs then [] else x:butlast xs
fold :: (a -> b -> b) -> [a] -> b -> b
fold f [] = id
fold f (x:xs) = fold f xs . f x