Building your own function objects in Scala