Solution (source code)

= Solution

A <right fold> replaces the empty <list> by a seed and each cons by an application of the combining <function>:

``
foldr :: (a -> b -> b) -> b -> [a] -> b
foldr op e [] = e
foldr op e (x:xs) = op x (foldr op e xs)
``

For example, `foldr op e [a,b,c] = op a (op b (op c e))`. The concise defining law is
$$
\boxed{\operatorname{foldr}\ op\ e\ (x:xs)=op\ x\ (\operatorname{foldr}\ op\ e\ xs),\qquad
\operatorname{foldr}\ op\ e\ []=e.}
$$