Does haskell's foldr always take a two-parameter lambda?
Haskell newb here I'm working on this problem in haskell: (**) Eliminate consecutive duplicates of list elements. If a list contains repeated elements they should be replaced with a single copy of the element. The order of the elements should not be changed. Example: * (compress '(a a a a b c c a a d e e e e)) (A B C A D E) The solution (which I had to look up) uses foldr: compress' :: (Eq a) => [a] -> [a] compress' xs = foldr (\x acc -> if x == (head acc) then acc else x:acc) [last xs] xs This foldr, according to the solution, takes two parameters, x and acc. It would seem like all foldr's