(*1*)
fun is_older (d1:int*int*int, d2:int*int*int)=if(#1 d1)<>(#1 d2)
then (#1 d1)<(#1 d2)elseif(#2 d1)<>(#2 d2)
then (#2 d1)<(#2 d2)else(#3 d1)<(#3 d2)(*2*)
fun number_in_month (d:(int*int*int) list, m:int)=if null d
then 0elseif #2(hd d)= m
then 1+number_in_month(tl d,m)elsenumber_in_month(tl d,m)(*3*)
fun number_in_months (d:(int*int*int) list, m:int list)=if null m
then 0elsenumber_in_month(d,hd m)+number_in_months(d,tl m)