Scala Map for List

Ready for our first dive into Functional Programming? Don't worry, we are going through this adventure together and I will make sure you don't get lost.

This is the moment where you might hear about Monad, Monoid, Functors, but we are not doing any of that today. Today we are just learning about a function from the standard library called map. We can put fancy names on it later.

You might have understood that map is actually just like a for each from other languages.

If you don't know about it from other language, not to worry.

map will just apply a function to each element of the list and return the list with the new values.

If you have a list of type A and you apply a function that transforms a type A to a type B then you will have an output being a list of type B.

That's it ! You did well for a first dive into Functional Programming. In upcoming SKBs we will go deeper into this aspect of Scala.

Reveal more information and clues
Load Exercise