A purely functional solution for the pascal triangle problem in Scala