I am trying to learn SML, and I am trying to implement two functions. The first function works fine, but when I added the second function it gives me an run-time error:
Your question sounds surprisingly much like these other questions: SML list iteration (8 months ago), recursion in SML (9 months ago), and Count elements in a list (8 months ago), so you certainly don't get points for asking a creative question.
Some of the questions above have been answered extensively. Look at them.
Here is your code rewritten in a better style:
(* Find better variable names than x, y and z. *)
fun is_older ((x1,y1,z1), (x2,y2,z2)) =
x1 < x2 andalso y1 < y2 andalso z1 < z2
fun number_in_month ([], mo) = 0
| number_in_month ((x,y,z)::rest, mo) =
if y = mo then 1 + number_in_month(rest, mo)
else 0 + number_in_month(rest, mo)