mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Fix syntax of tag variants in the list example
This commit is contained in:
parent
1c1dc651a7
commit
0633c7ae6e
@ -2193,9 +2193,9 @@ a = cat;
|
||||
|
||||
An example of a @emph{recursive} @code{tag} type and its use:
|
||||
@example
|
||||
type list[T] = tag(nil,
|
||||
type list[T] = tag(nil(),
|
||||
cons(T, @@list[T]));
|
||||
let list[int] a = cons(7, cons(13, nil));
|
||||
let list[int] a = cons(7, cons(13, nil()));
|
||||
@end example
|
||||
|
||||
|
||||
@ -3315,9 +3315,9 @@ control enters the block.
|
||||
An example of a pattern @code{alt} statement:
|
||||
|
||||
@example
|
||||
type list[X] = tag(nil, cons(X, @@list[X]));
|
||||
type list[X] = tag(nil(), cons(X, @@list[X]));
|
||||
|
||||
let list[int] x = cons(10, cons(11, nil));
|
||||
let list[int] x = cons(10, cons(11, nil()));
|
||||
|
||||
alt (x) @{
|
||||
case (cons(a, cons(b, _))) @{
|
||||
|
Loading…
Reference in New Issue
Block a user