mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Added a comment to better demonstrate custom datatypes.
It is not obvious for a beginner (like me) to declare a new value of the temp datatype which can be either C (celsius) or F (fahrenheit). I think it would be better to demonstrate the declaration of such a datatype.
This commit is contained in:
parent
c85d93a5ed
commit
c4664b31e5
@ -272,6 +272,9 @@ fun evenly_positioned_elems (odd::even::xs) = even::evenly_positioned_elems xs
|
|||||||
datatype temp =
|
datatype temp =
|
||||||
C of real
|
C of real
|
||||||
| F of real
|
| F of real
|
||||||
|
|
||||||
|
(* Declaring a new C temp value...
|
||||||
|
val t: temp = C 45.0 *)
|
||||||
|
|
||||||
fun temp_to_f t =
|
fun temp_to_f t =
|
||||||
case t of
|
case t of
|
||||||
|
Loading…
Reference in New Issue
Block a user