Content deleted Content added
→Optimizations: I have never heard of the 'm f' notation and it certainly wasn't introduced above |
→Optimizations: «"a possibly" → "an"» |
||
Line 17:
==Optimizations==
The mathematical basis of maps allow for a number of [[optimization]]s. If one has <code>map f . map g</code> ('.' is [[function composition]]) then it is the same as the simpler <code>map (f . g) xs</code>; that is,
<math>\left( \text{map}\,f \right) \circ \left( \text{map}\,g \right) = \text{map}\,\left( f \circ g \right)</math>. This particular optimization eliminates
Map functions can and often are defined in terms of a [[Fold (higher-order function)|fold]] such as <code>foldr</code>, which means one can do a "map-fold fusion": <code>f z . map g</code> is equivalent to <code>foldr (f . g) z</code>.
|