Map (higher-order function): Difference between revisions

Content deleted Content added
mNo edit summary
Line 9:
==Examples: mapping a list ==
 
Suppose we have a list of integers <code>[1, 2, 3, 4, 5]</code> and would like to calculate the [[Square (algebra)|square]] of each integer. To do this, we first define a function to <code>square</code> a single number (shown here in [[Haskell (programming language)|Haskell]]):
 
<syntaxhighlight lang="haskell">