FP in Scala