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:
Chariton Charitonidis 2019-03-15 11:01:23 +02:00 committed by GitHub
parent c85d93a5ed
commit c4664b31e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,6 +273,9 @@ 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
C x => x * (9.0 / 5.0) + 32.0 C x => x * (9.0 / 5.0) + 32.0