Today’s topic is a big one, and it’s only the beginning of a long, deep journey. We want to consider the seemingly humble map
function in all of its glory. Many people point to the presence of map
in a language as being a strong indicator of the language having “functional” tendencies. You’ll often hear “language ABC has support for functional concepts like map
, filter
, reduce
, etc”, and the mention of map
is always first! Why is that?!
Swift must be doubly functional because it comes with two map
s! One on arrays and one on optionals!
We want to build intuition for why map
seems to be so ubiquitous in “functional-leaning” languages, and in fact there are lots of other map
s lurking in the shadows of our everyday Swift code that we have yet to explore.