1

Via CpdtTactics.v:

[...] Succeed iff x is in the list ls, 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?

Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46

2 Answers2

3

Via private communication with Adam:

No, I can't think of any way to prefer one version over the other, actually. I just had to make some choice for that part of the book.

Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46
3

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).

Li-yao Xia
  • 31,896
  • 2
  • 33
  • 56