zips and maps
Fri, 9 Mar 2001 13:31:24 +1100 (EST)
Eric Allen Wohlstadter writes:
> I find myself very often needing to use this function and was wondering if
> there was already a way to do this using zip,maps, and folds.
> zipMap  _ = 
> zipMap _  = 
> zipMap (f:fs) (x:xs) = (f x):(zipMap fs xs)
> Both require me to invent some new function (or use a lambda) which I am
> trying to avoid. If it is unavoidable then can someone think of a better
> name then zipMap?
The following is more concise, and probably how I would do it:
zipMap :: [a->b] -> [a] -> [b]
zipMap = zipWith ($)