Skip to content

Latest commit

 

History

History
 
 

workshop3

Workshop 3

In this workshop we cover collections, Option, Try and higher-order functions on these classes. Please, read through the material in the following order, before proceeding to the assignments.

  1. higher-order functions - getting to know what a higher-order function is, how it looks and how you use it
  2. some basic higher-order functions in Scala
  3. Option - introducing the Option type as a better alternative to null values
  4. flatMap and for-comprehension on Option
  5. for-comprehension on List
  6. Try - introducting the Try type as the way of handling errors in a functional way
  7. other collections - conversion between Java and Scala collections and some more operators

Further reading/watching (totally optional)

  • Scala API - Documentation of the Scala API. Make sure you have this page open in your browser all the time!
  • Monads in pictures - The map and flatMap operators that we used in this workshop are formalized in the concepts of Functor and Monad. This is a good post to understand what these do and how map and flatMap are supposed to behave.
  • Learn You a Haskell for Great Good - For the ones that are really interested in functional programming, this book is the place to start!
  • Scala Monads - A good starter explanation of the Option, Try and List monads that shows remarkable similarities with our explanation 😜...