Scala Red Book Notes - ksree/ProgrammingScala GitHub Wiki

  • FP -> pure functions are modular. Makes it easier to test , reuse, parallelize.
  • For a program to be Referential Transparent, the expression can be replaced by its result without changing the meaning of the program. And we say a function is pure if by calling it with RT arguments is also RT.
  • A call is said to be in tail position if the caller does nothing other than return the value of the recursive call. Functions as values in Scala
  • When we define a function literal, what is actually being defined in Scala is an object with a method called apply. val lessThan = new Function2[Int, Int, Boolean] { def apply(a: Int, b: Int) = a < b }