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:
stdIn:1.2-1.17 Error: unbound variable or constructor: number_in_month
This happens while calling the function number_in_month. My code is:
fun is_older(d1 :int*int*int,d2 :int*int*int) =
(#1 d1) < (#1 d2) andalso (#2 d1) < (#2 d2) andalso (#3 d1) < (#3 d2)
fun number_in_month(da :(int * int * int) list ,mo : int) =
if da = []
then 0
else if (#2(hd da)) = mo
then 1 + number_in_month((tl da),mo)
else 0 + number_in_month((tl da),mo)