See [http[wp://en.wikipedia.org/wiki/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.
data Tree = Empty
Line 475:
===Algebraic Data Type===
See [http[wp://en.wikipedia.org/wiki/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.
<lang ocaml>type tree = Empty
Line 789:
===Algebraic Data Type===
See [http[wp://en.wikipedia.org/wiki/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.
<lang sml>datatype tree = Empty
Cookies help us deliver our services. By using our services, you agree to our use of cookies.