[Haskell-cafe] Library function for map+append

Tony Morris tonymorris at gmail.com
Tue Aug 18 07:28:25 EDT 2009


Dusan Kolar wrote:
> Hello all,
>
>  During a small project I'm trying to develop a small application. It
> becomes quite often that I need a function mapapp:
>
> mapapp _ [] ap = ap
> mapapp f (a:as) ap = f a : map f as ap
>
>  I tried hoogle to find such a function with no success. Is there any
> function/functions built-in "standard" libraries that could easily
> satisfy the functionality with the same or even better (?) efficiency?
>
>  Of course,
> (map f list) ++ append 
>  would do the same as
>
> mapapp f list append
>
>  but with less efficiency. Or am I wrong?
>
>  Thanks
>
>    Dusan
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
mapapp = ((++) .) . map

Reasoning about efficiency in a pure lazy language is different.

-- 
Tony Morris
http://tmorris.net/




More information about the Haskell-Cafe mailing list