我是 ML 编程的新手,我有一个作业要编写一个函数 is_older,它需要两个日期并评估为真或假。如果第一个参数是第二个参数之前的日期,则它的计算结果为 true。
(如果两个日期相同,则结果为假。)
val is_older = fn : (int * int * int) * (int * int * int) -> bool // Binding Like
我试过这个(使用New Jersy cmd prompt的SML)
fun is_older((y1,m1,d1),(y2,m2,d2))= if (y1<y2) then true
else if (y1=y2 andalso m1<m2) then true
else if (y1=y2 andalso m1=m2 andalso d1<d2) then true;
它给出了错误
Error syntax error: deleting SEMICOLON ID