If you followed along, you might remember
map from the
List. In Scala, and in functional programming, you are going to hear about
map a whole bunch.
map comes from the functional programming world, and from category theory in mathematics. We are going to dive deeper into those two concepts in the future but for now let's focus only on the
Just to throw it out there, but don't get hang on it too much,
map is part of what is called a
Can you feel that the “m” word is going to show up soon ? Should we pop the bubble now ?
Let's rip off the bandage, right now. MONAD !
That's it, we said it. There is no turning back now. Good luck !
Have you recovered from the m-encounter ? Using the
map wasn't too bad, was it? And you used it before with the
There are few things to try to modify in this exercise. Go ahead and try those:
input is set to
get ? with
Some and with
.map(a => a + 1) in your solution, try replacing
a => a by
_. This is some teasing for some upcoming SKB.