Compound data type: Difference between revisions

Content added Content deleted
m (Omit from bc and dc)
Line 943: Line 943:


===Algebraic Data Type===
===Algebraic Data Type===
See [[wp:Algebraic_data_type|algebraic data type]]. The different options ("Empty", "Leaf", "Node") are called ''constructors'', and is associated with 0 or 1 arguments with the declared types; multiple arguments are handled with tuples.
See [[wp:Algebraic_data_type|algebraic data type]]. The different options ("Empty", "Leaf", "Node") are called ''constructors'', and is associated with 0 or more arguments with the declared types; multiple arguments are declared with a syntax that looks like a tuple type, but it is not really a tuple.


<lang ocaml>type tree = Empty
<lang ocaml>type tree = Empty