Categories
Functional Programming - Scala

Functional Programming in Scala – Week 2

Week 2 delved more into tail recursion but more broadly review higher order functions. Looking at perhaps the key characteristic of functional programming languages we found that functions are treated as first class values. Meaning like any other values, functions can be passed as a parameter and returned as a results. This becomes important later in the course and in real world applications where the resolution of values can be deferred until the optimal time.

Another key point of functional programming was introduced, immutable values.  How immutable values related to distributed and parallel programming was touched on briefly. Odersky elaborates on this in the following presentation:

 

The concept of currying was also explained. In essence the passing of functions to functions in the interest of simplifying and generalizing code. These concepts and some of the different function types are details that have not stuck with me very well since the course. I guess that happens when you don’t write a lot of code in a language then leave if for e few months.

Week 2’s assignment was relatively straight forward and followed the contents of the weeks lectures.

Week 2 Assignment code

Week 2 Lectures 

 

One reply on “Functional Programming in Scala – Week 2”

Leave a Reply

Your email address will not be published. Required fields are marked *