and :: [ Bool ] -> Bool and l = case l of x : xs -> x && and xs ; [] -> True length :: [ a ] -> Int length l = case l of x : xs -> 1 + length xs ; [] -> 0 fold :: ( a -> b -> b ) -> b -> [a] -> b fold cons nil l = case l of x : xs -> cons x ( fold cons nil xs ) [] -> nil and = fold (&&) True length = fold ( \ x y -> 1 + y) 0