Skip to main content

Questions tagged [tuple]

For questions about the design or implementation of tuples, or anonymous structs. Tuples are collections of several different values, and unlike arrays they can be of different types.

Filter by
Sorted by
Tagged with
8 votes
3 answers
298 views

How is a structure different from a tuple with named elements?

I saw this answer which suggests tuple syntax, similar to that in Swift, where the elements can be named. However, how is that functionally different from a plain struct? Both are collections of named ...
CPlus's user avatar
  • 8,261
8 votes
3 answers
148 views

How can single-item tuples be disambiguated from the grouping operator?

While single-item tuples aren't particularly useful, disallowing them entirely, or allowing them but with few to no valid representations in syntax, may also be undesirable. However, since tuples ...
Rydwolf Programs's user avatar
2 votes
3 answers
254 views

How should a language with period-based tuple indexing be parsed?

A few languages, most notably Rust, have tuple-indexing syntax that looks like this: tuple.0 // Access the first element of tuple This syntax is quite similar to ...
Ginger's user avatar
  • 2,619
11 votes
7 answers
514 views

What are the different ways of handling multiple return values?

(inspired by this question) Different programming languages handle multiple return values differently, used in functions such as divmod. For example, in Python or ...
naffetS's user avatar
  • 1,047