| 1 |
Undelimit Scope list_scope. |
| 2 |
Declare Custom Entry gnat. |
| 3 |
Declare Custom Entry gargs. |
| 4 |
|
| 5 |
Notation "!" := 42 (in custom gnat). |
| 6 |
Notation "gargs:( e )" := e (e custom gargs). |
| 7 |
Notation "( x )" := (cons x (@nil nat)) (in custom gargs, x custom gnat). |
| 8 |
Notation "( x , y , .. , z )" := (cons x (cons y .. (cons z nil) ..)) |
| 9 |
(in custom gargs, x custom gnat, y custom gnat, z custom gnat). |
| 10 |
|
| 11 |
Check gargs:( (!) ). (* cons 42 nil *) |
| 12 |
Check gargs:( (!, !, !) ). (* cons 42 (42 :: 42 :: nil) *) |
| 13 |
|
| 14 |
Definition OnlyGargs {T} (x:T) := x. |
| 15 |
Notation "OnlyGargs[ x ]" := (OnlyGargs x) (at level 0, x custom gargs). |
| 16 |
Check OnlyGargs[ (!) ]. (* OnlyGargs[ cons 42 nil] *) |
| 17 |
|
| 18 |
Declare Custom Entry gargs999. |
| 19 |
Notation "gargs999:( e )" := e (e custom gargs999 at level 999). |
| 20 |
Notation "( x )" := (cons x (@nil nat)) (in custom gargs999, x custom gnat at level 999). |
| 21 |
Notation "( x , y , .. , z )" := (cons x (cons y .. (cons z nil) ..)) |
| 22 |
(in custom gargs999, x custom gnat at level 999, y custom gnat at level 999, z custom gnat at level 999). |
| 23 |
|
| 24 |
Check gargs999:( (!) ). (* gargs999:( (!)) *) |
| 25 |
Check gargs999:( (!, !, !) ). (* gargs999:( (!, !, !)) *) |
| 26 |
Check OnlyGargs[ (!) ]. (* OnlyGargs[ gargs999:( (!))] *) |
| 27 |
|
| 28 |
Definition OnlyGargs999 {T} (x:T) := x. |
| 29 |
Notation "OnlyGargs999[ x ]" := (OnlyGargs999 x) (at level 0, x custom gargs999 at level 999). |
| 30 |
Check OnlyGargs999[ (!) ]. (* OnlyGargs999[ (!)] *) |