Map (higher-order function): Difference between revisions

Content deleted Content added
Loillibe (talk | contribs)
m Change text formula to math formula
Loillibe (talk | contribs)
Precisions on lists names
Line 25:
map _ [] = []
map f (x : xs) = f x : map f xs
</syntaxhighlight>Now, suppose we have a list of integers X <code>[0, 5, 8, 3, 2, 1]</code> and we want to map it into a new list X' with the function <math>f(x) = x + 1</math>, you can see below a view of each step of the mapping process :
[[File:Mapping-steps-loillibe-new.gif|alt=applying map function processing steps|none|thumb|480x480px|View of processing steps when applying map function on a list]]