Tips for golfing in Scala What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" is not an answer). Please post one tip per answer.

(This is a shameless copy of ... in Python)
The shortest way of repeating something is with Seq.fill.

1 to 10 map(_=&gt;println("hi!")) // Wrong!
for(i&lt;-1 to 10)println("hi!") // Wrong!
Seq.fill(10)(println("hi!")) // Right!