Pre-SIP: A Syntax for Collection Literals

between

and

there could be:

val v = Vector // or alternatively you could do import with renaming
val matrix = v(
  v(1, 0, 0),
  v(0, 1, 0),
  v(0, 0, 1)
)

it works already for scala 2 and scala 3: Scastie - An interactive playground for Scala. and it has majority of the conciseness advantages

5 Likes