Both are product types that allow you to create types from several simpler types. Some languages ββview tuples as a kind of record.
Definitions
A tuple is an ordered group of elements, for example (10, 25).
Typically, a record is a group of named elements, such as { "x": 10, "y": 25 } , where the value has two fields labeled x and y , and the value of the field x is 10 .
Morphological
The word "tuple" comes from the common suffix "-tuple" to "fivefold", "sixfold", "septile", "eight", which means groups of 5, 6, 7 and 8, respectively.
The word "record" comes from data tables. You can represent all possible tuples with fields x and y in the form of a table in which the columns correspond to the fields and rows that collect all the fields for a particular instance of the record.
value address field x field y 0xABCD 10 25 0x1234 42 "xyz"
Product Type Equivalence
You can consider a tuple as a kind of record, where the index of the element in the tuple is its name in the equivalent record, therefore (10, 25) - { "0": 10, "1": 25 } . I believe that the ML standard and related languages ββuse records as the basic unit of the join type ( algebraic data types provide type disjunction) and treat tuples as a kind of record in this way.
Mike Samuel Nov 18 '10 at 6:44 2010-11-18 06:44
source share