OCaml types have always really confused me no matter what tutorials/manuals I read. I need to define a type, let's say test, that does contains the following forms:
a type ('a, 'b) test that has one of the forms: Empty, T t, N n, Seq [x1...xn]
I know how to do the first 3, but I have absolutely no idea how to define the last form. This is what I have:
type ('nonterm, 'term) test =
| Empty
| T of 'term
| N of 'nonterm
| ????
For seq, I need to match the instances of subexpressions x1 to xn. If x = 0, then this is empty. Can anybody please help me? Thanks in advance.