|
8 | 8 |
|
9 | 9 | This RFC proposes the addition of several features to support variadic generics:
|
10 | 10 | - An intrinsic `Tuple` trait implemented exclusively by tuples
|
11 |
| -- `(Head, ...Tail)` syntax for tuple types where `Tail: Tuple` |
| 11 | +- `...T` syntax for tuple types where `T: Tuple` |
12 | 12 | - `let (head, ...tail) = tuple;` pattern-matching syntax for tuples
|
13 | 13 | - `let tuple = (head, ...tail);` syntax for joining an element with a tuple
|
14 | 14 |
|
@@ -142,9 +142,10 @@ patterns for working with `Cons`-cell based lists. Rustaceans coming from
|
142 | 142 | other functional programming languages will likely be familiar with the concept
|
143 | 143 | of recursively-defined lists. For those unfamiliar with `Cons`-based
|
144 | 144 | lists, the concept should be introduced using "structural recursion": there's
|
145 |
| -a base case, `()`, and a recursive/inductive case: `(Head, ...Tail)`. Any tuple |
146 |
| -can be thought of in this way |
147 |
| -(for example, `(A, B, C)` is equivalent to `(A, ...(B, ...(C, ...())))`). |
| 145 | +a base case, `()`, and a recursive/inductive case: `(Head, ...Tail)` or |
| 146 | +`(Front..., Last)`. Any tuple can be thought of in this way |
| 147 | +(for example, `(A, B, C)` is equivalent to `(A, ...(B, ...(C, ...())))` |
| 148 | +and `(A, ...(B, ...(C, ...())))`). |
148 | 149 |
|
149 | 150 | When teaching this new syntax, it is important to note that the proposed system
|
150 | 151 | allows for more complicated matching than traditional `Cons`-lists. For example,
|
|
0 commit comments