[Haskell-cafe] Re: [Haskell] Trying to get a Composite design
pattern to work
haskell at list.mightyreason.com
Tue Mar 14 19:54:05 EST 2006
Neil Mitchell wrote:
>> How's this?
> What about ++, in Haskell thats just an ordinary function, yet you are
> using the library one in this case.
(++) a b = foldr (:) b a
(++) = flip (foldr (:))
concat = foldr (flip (foldr (:))) 
map = (\f -> foldr ((:).f) )
concatMap = (\f -> (foldr (flip (foldr (:))) ) . (foldr ((:).f) ))
No recursive definitions in sight...all built with foldr
More information about the Haskell-Cafe