Why is Scala's syntax for tuples so unusual?

前端 未结 7 1178
广开言路
广开言路 2020-12-08 13:10

In mathematics and computer science, a tuple is an ordered list of elements. In set theory, an (ordered) n-tuple is a sequence (or ordered list) of n elem

7条回答
  •  Happy的楠姐
    2020-12-08 13:36

    Apart from the benefits Jean-Philippe Pellet already mentioned this notation is also very common in mathematics (see http://en.wikipedia.org/wiki/Tuple). A lot of lecturers append indexes to tuple variables if they want to referring to the elements of a tuple. And the common (LaTeX) notation for writing "with index n" (referring to the n-th element of the tuple) is _n. So I find it actually very intuitive.

提交回复
热议问题