Skip to Content
Programming Languages: Concepts and Implementation
book

Programming Languages: Concepts and Implementation

by Saverio Perugini
December 2021
Beginner
840 pages
47h 29m
English
Jones & Bartlett Learning
Content preview from Programming Languages: Concepts and Implementation

B.7 Tuples

A tuple is a sequence of elements of potentially mixed types. Formally, a tuple is an element e of a Cartesian product of a given number of sets: e ∈ (S1 × S2 × … × Sn). A two-element tuple is called a pair [e.g., e ∈ (A × B)]. A three-element tuple is called a triple [e.g., e ∈ (A × B × C)]. A tuple typically contains unordered, heterogeneous elements akin to a struct in C with the exception that a tuple is indexed by numbers (like a list) rather than by field names (like a struct). While tuples can be heterogeneous, in a list of tuples, each tuple in the list must be of the same type. Elements of a tuple are accessible by prefacing the tuple with #n, where n is the number of the element, starting with 1:

Description

The response ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Concepts and Semantics of Programming Languages 1

Concepts and Semantics of Programming Languages 1

Therese Hardin, Mathieu Jaume, Francois Pessaux, Veronique Viguie Donzeau-Gouge
Programming C# 10

Programming C# 10

Ian Griffiths

Publisher Resources

ISBN: 9781284222739