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 calledmap. We can put fancy names on it later.

You might have understood thatmapis actually just like afor eachfrom other languages.

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

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

If you have a list of typeAand you apply a function that transforms a typeAto a typeBthen you will have an output being a list of typeB.

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