Skip to content

Commit 70f318f

Browse files
committed
One Sentence One Line: Tuple Type
1 parent e32a2f9 commit 70f318f

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/types/tuple.md

+16-20
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@
55
>       `(` `)`\
66
> &nbsp;&nbsp; | `(` ( [_Type_] `,` )<sup>+</sup> [_Type_]<sup>?</sup> `)`
77
8-
The *tuple type* is a structural type[^1] for heterogeneous lists of other
9-
types. Each entry in the list is an *element*[^2] of the tuple. The position of
10-
the element makes it the *nth element* using zero (`0`) as the initial index.
8+
The *tuple type* is a structural type[^1] for heterogeneous lists of other types.
9+
Each entry in the list is an *element*[^2] of the tuple.
10+
The position of the element makes it the *nth element* using zero (`0`) as the initial index.
1111

12-
The number of elements determines the arity of the tuple. A tuple with `n`
13-
elements is called an `n-ary tuple`. For example, a tuple with 2 elements is a
14-
2-ary tuple.
12+
The number of elements determines the arity of the tuple.
13+
A tuple with `n` elements is called an `n-ary tuple`.
14+
For example, a tuple with 2 elements is a 2-ary tuple.
1515

16-
For convenience and historical reasons, the tuple type with no elements (`()`)
17-
is often called *unit* or *the unit type*. It's one value is also called *unit*
18-
or *the unit value*.
16+
For convenience and historical reasons, the tuple type with no elements (`()`) is often called *unit* or *the unit type*.
17+
It's one value is also called *unit* or *the unit value*.
1918

20-
Tuple types are written by listing the types of their elements in a
21-
parenthesized, comma-separated list. 1-ary tuples require a comma after their
22-
element type to be disambiguated with a [parenthesized type].
19+
Tuple types are written by listing the types of their elements in a parenthesized, comma-separated list.
20+
1-ary tuples require a comma after their element type to be disambiguated with a [parenthesized type].
2321

2422
Some examples of tuple types:
2523

@@ -29,16 +27,14 @@ Some examples of tuple types:
2927
* `(i32, String)` (different type from the previous example)
3028
* `(i32, f64, Vec<String>, Option<bool>)`
3129

32-
Values of this type are constructed using a [tuple expression]. Furthermore,
33-
various expressions will produce the unit value if there is no other meaningful
34-
value for it to evaluate to. Tuple elements can be accessed by either a [tuple
35-
index expression] or [pattern matching].
30+
Values of this type are constructed using a [tuple expression].
31+
Furthermore, various expressions will produce the unit value if there is no other meaningful value for it to evaluate to.
32+
Tuple elements can be accessed by either a [tuple index expression] or [pattern matching].
3633

37-
[^1]: Structural types are always equivalent if their internal types are
38-
equivalent. For a nominal version of tuples, see [tuple structs].
34+
[^1]: Structural types are always equivalent if their internal types are equivalent.
35+
For a nominal version of tuples, see [tuple structs].
3936

40-
[^2]: Element is equivalent to field, except numerical indexes instead of
41-
identifiers
37+
[^2]: Element is equivalent to field, except numerical indexes instead of identifiers
4238

4339
[_Type_]: ../types.md#type-expressions
4440
[parenthesized type]: ../types.md#parenthesized-types

0 commit comments

Comments
 (0)