add Higher-Order Functions in Scala