
12 Feb
2007
12 Feb
'07
1:40 p.m.
Guess this is a tricky choice for a foldr intro, since it requires a "paramorphism" (see bananas lenses wires etc.)
para :: (a -> [a] -> b -> b) -> b -> [a] -> b para f e [] = e para f e (x:xs) = f x xs (para f e xs)
-- note that the original tail of the list (i.e. xs and not xs') is used in the else-branch dropWhile' p = para (\x xs xs' -> if p x then xs' else (x:xs)) [] Actually, several people tried to use para, but of course it is not in
Nicolas Frisby wrote: the spirit of the challenge :) Cheers, Bernie.