The ADT page refers to several constructors created with the syntax Constructor of type1 * type2 as being a type1, type2 pair. The tuple page says that a pair is another word for a 2-tuple. However, Constructor of type1 * type2 (a constructor with two elements) is different from Constructor of (type1 * type2) (a constructor with a single tuple element).
This can be demonstrated pretty easily. This snippet won't compile:
type thing_type = Thing of int * int;;
let mypair = (1, 2);;
Thing mypair;;
(* => Error: The constructor Thing expects 2 argument(s), but is applied here to 1 argument(s) *)
But this one will:
type thing_type = Thing of (int * int);;
let mypair = (1, 2);;
Thing mypair;;
(* => - : thing_type = Thing (1, 2) *)
I think that the language on this page could be clarified to explain that Thing of int * int and Thing of (int * int) are actually different.
The ADT page refers to several constructors created with the syntax
Constructor of type1 * type2
as being atype1
,type2
pair. The tuple page says that a pair is another word for a 2-tuple. However,Constructor of type1 * type2
(a constructor with two elements) is different fromConstructor of (type1 * type2)
(a constructor with a single tuple element).This can be demonstrated pretty easily. This snippet won't compile:
But this one will:
I think that the language on this page could be clarified to explain that
Thing of int * int
andThing of (int * int)
are actually different.See also: https://ocaml.org/docs/data-types#a-note-on-tupled-constructors