How should I think about Scala's Product classes?

前端 未结 5 1508
情深已故
情深已故 2020-12-07 22:19

The package \"scala\" has a number of classes named Product, Product1, Product2, and so on, up to Product22.

The descriptions of these classes are surely precise. Fo

5条回答
  •  萌比男神i
    2020-12-07 23:04

    A cartesian product is a product of sets. Given sets A and B, A x B ("A cross B") is the set of all tuples (x, y) such that x is in A and y is in B. A cartesian product may be analogously defined on types: given types A and B, A x B is the type of tuples (x, y) where x is of type A and y is of type B.

    So Product4 is the type of tuples (w, x, y, z), where w, x, y, z are components.

提交回复
热议问题