+ type color = { red : int; green : int; blue : int };;
+ let c = { red = 0; green = 127; blue = 255 };;
+ let r = c.red;;
+
+ You could instead just use a more familiar data constructor:
+
+ type color = Color of (int * int * int);;
+ let c = Color (0, 127, 255);;
+
+ and then extract the field you want using pattern-matching:
+
+ let Color (r, _, _) = c;;
+ (* or *)
+ match c with Color (r, _, _) -> ...
+
+ (Or you could just use bare tuples, without the `Color` data constructor.)
+
+ The record syntax only exists because programmers sometimes find it more convenient to say:
+
+ ... c.red ...
+
+ than to reach for those pattern-matching constructions.
+
+
+
+##Functions##