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

or

(++) = flip (foldr (:))

so

concat = foldr (flip (foldr (:))) []

also

map = (\f -> foldr ((:).f) [])

thus

concatMap = (\f -> (foldr (flip (foldr (:))) []) . (foldr ((:).f) []))

No recursive definitions in sight...all built with foldr

-- 
Chris
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to