私は SML を初めて使用し、2 年かけてそれらを比較し、次に 2 か月かけてそれらを比較し、最後に 2 つの日付を比較するプログラムを作成しました。
私が抱えている問題は、年が最初の年よりも古い場合は停止してfalseにする必要があることですが、それが私のロジックなのか何かわからない場合は、trueまたはfalseを返す前に月と日付をチェックし続けます.
年が false の場合は月のみをチェックし、月が false の場合は日のみをチェックします。
fun is_older(year1 : int, month1 : int, day1 : int, year2 : int, month2 : int, day2 : int) =
if year1 < year2 andalso year1 > 0
then true
else
if month1 < month2 andalso month1 > 0 andalso month2 <= 12
then true
else
if day1 < day2 andalso day1 > 0 andalso day2 <= 31
then true
else false;