Why are the indexes of Scala tuples 1-based?

I guess _1, _2 etc it is short for “first”, “second”, and so on. (fst and snd for instance have historically been used for accessing the left and right part of a tuple). The index in an array on the other hand is an offset and the first element is usually at offset 0.

Are there any mathematical/programming benefits in having 1-based indexed tuples and not 0-based?

No. The elements are not accessed programatically anyway. (You can’t do _i if i is an integer.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)