What is the syntactic sugar equivalent of following syntax:
List[Tuple2[String, Int]] // Base
List[String Tuple2 Int] // Syntactic sugar
for Tuple3? E.g.:
List[Tuple3[String, Float, Int]] // Base
This makes no sense. Infix syntax by definition works only for arity 2. That's not something special to Scala, that's not even special to programming, that's how it has always been and how it will always be. Infix operators are called infix operators because they sit in between their two operands. How can one operator sit in between three operands? You would need a two-part operator to sit in the two spaces between the three operands. Such operators do exist, they are called ternary operators, but it's not quite trivial to devise a syntax for using them interchangeably with prefix syntax, like Scala does.
Note, however, that there is syntactic sugar for what you are asking about:
List[Tuple2[String, Int]] // Base
List[(String, Int)] // Syntactic sugar
List[Tuple3[String, Float, Int]] // Base
List[(String, Float, Int)] // Syntactic sugar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With