Via CpdtTactics.v
:
[...] Succeed iff
x
is in the listls
, represented with left-associated nested tuples.
Ltac inList x ls := match ls with | x => idtac | (_, x) => idtac | (?LS, _) => inList x LS end.
This seems atypical. Doesn't the tail of the list conventionally go in the right-hand side of the tuple?
Somehow n-tuples are nested pairs associated to the left:
(x, y, z)
desugars to
pair (pair x y) z
And that's what we get if we want to write inList x (x, y, z)
.