Functional Programming using Scala