I am trying to create a simple function that takes two dates of format int*int*int and return if the first one is older than the second or not.
fun is_older (date1: (int*int*int), date2: (int*int*int)) =
val in_days1 = (#1 (date1) * 365) + (#2 (date1) * 30) + #3 date1;
val in_days2 = (#1 (date2) * 365) + (#2 (date2) * 30) + #3 date1;
if in_days1 < in_days2
then true
else false
I get this error:
hwk_1.sml:1.53 Error: syntax error: inserting EQUALOP
uncaught exception Compile [Compile: "syntax error"]
raised at: ../compiler/Parse/main/smlfile.sml:15.24-15.46
../compiler/TopLevel/interact/evalloop.sml:44.55
../compiler/TopLevel/interact/evalloop.sml:296.17-296.20
Can anyone help please?
if-then-else
just with the condition,in_days1 < in_days2
. – Michael J. Barber