Map (higher-order function): Difference between revisions

Content deleted Content added
Generalization: add see also
separate example from lead, other minor fixes
Line 1:
{{one source|date=November 2012}}
In many [[programming language]]s, <code>'''map'''</code> is the name of a [[higher-order function]] that applies a given [[Procedural parameter|function]] to each element of a [[list (computing)|list]], returning a list of results. It is often called ''apply-to-all'' when considered in [[functional form]]. <!-- This is an example of [[functor]]iality. <!-- ex, map f = foldr ((:) . f) [] -->
 
==Example==
For example, if we define in [[Haskell (programming language)|Haskell]] a function <code>square</code> as follows:
 
<source lang="haskell">