Reverse polish notation calculator in Scala