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
You can easily achive that with shapeless:
import shapeless.syntax.std.tuple._
val t = ("a", 2, true, 0.0)
val s = t(0) // String at compile time
val i = t(1) // Int at compile time
// etc
A lot of methods available for standard collection are also available for tuples this way (head
, tail
, init
, last
, ++
and :::
for concatenation, +:
and :+
for adding elements, take
, drop
, reverse
, zip
, unzip
, length
, toList
, toArray
, to[Collection]
, ...)