元组与记录
元组和记录有什么区别?
What is difference between tuples and records?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
元组和记录有什么区别?
What is difference between tuples and records?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
两者都是产品类型,可让您从多个更简单的类型构建类型。有些语言将元组视为一种记录。
定义
元组是一组有序的元素,例如 (10, 25)。
记录通常是一组命名元素,例如
{ "x": 10, "y": 25 }
,其中值有两个标记为x
和y 的字段
,字段x
的值为10
。词源
“元组”一词来自“五元组”、“六元组”、“七元组”、“八元组”上常见的“-tuple”后缀,分别表示 5、6、7 和 8 的组。
“记录”一词来自数据表。您可以将具有
x
和y
字段的所有可能元组视为一个表,其中列对应于字段,行收集特定记录实例的所有字段。产品类型的等效性
您可以将元组视为一种记录,其中元组中元素的索引是其在等效记录中的名称,因此
(10, 25)
为{ “0”:10,“1”:25 }
。我相信标准机器学习和相关语言使用记录作为类型连词 (代数数据类型提供类型析取)并以这种方式将元组视为一种记录。Both are product types which let you build types from multiple simpler types. Some languages treat tuples as a kind of record.
Definitions
A tuple is an ordered group of elements, like (10, 25).
A record is typically a group of named elements like
{ "x": 10, "y": 25 }
where the value has two fields labelledx
andy
and the value of fieldx
is10
.Etymology
The word "tuple" comes from the common "-tuple" suffix on "quintuple", "sextuple", "septuple", "octuple" which mean groups of 5, 6, 7, and 8 respectively.
The word "record" comes from data tables. You can think of all possible tuples with
x
andy
fields as a table where columns correspond to fields and rows collect all the fields for a particular record instance.Equivalence of product types
You can treat a tuple as a kind of record, where the index of an element in a tuple is its name within the equivalent record, so
(10, 25)
is{ "0": 10, "1": 25 }
. I believe Standard ML and related languages use records as the basic unit of type conjunction (algebraic data types provide type disjunction) and treat tuples as a kind of record in this way.根据维基百科:
我想说元组和记录之间没有什么区别。
According to Wikipedia:
I would say there is little difference between a tuple and a record.
记录是一个表的一整行数据元素,假设一个学生在卷号下有一条记录。 3 在一个表中,其中元组是记录的超集,其中数据也属于其他表,例如学生卷号 3 的记录行在其他表中的关系,即出勤、结果、联系人、费用等。所以,所有表中一个学生的全部数据集都是元组。据我所知。
谢谢。
Record is a complete row of data elements of one table, let say a student has a record under roll no. 3 in one table, where as tuple is a super set of record in which data belongs to other tables also, e.g. rows of records of student roll no.3 in other tables in relationship i.e. attendance, results, contacts, fees etc. So, that whole lot of data set of one student from all tables is tuple. As I know it.
Thanks.