Scala Gems #4: Generating Data Matrices
Generating matrix-shaped test data is easy in any spreadsheet application: Enter a few cell values and use the fill handle to complete all others. But firing up a spreadsheet somehow feels lame. This Scala one-liner can do the same:
println(Array.fill(7, 3)("X").map(_.mkString("\t")).mkString("\n"))
Is it readable? No. Is it handy? Yes!











