问题
I'm supposed to write a program that takes a list of dates and then a month and returns the number of dates that include the month. I keep getting a syntax error and I don't understand why.
fun number_in_month (dates : int list, month : int) =
let val tally = 0
in
let fun tally_counter(tally_dates : int list)=
if (tally_dates[1]) = month
then (
tally = tally + 1
tally_counter(tl tally_dates)
)
else if null (hd tally_dates)
then tally
in
tally_counter(dates)
end
回答1:
It looks like you're missing the end
statement for your outermost let
, as well as an else
clause to your second if
statement.
Certainly, the first of these will cause a syntax error at EOF. I'm not sure about the second one, but I believe that it will as well.
来源:https://stackoverflow.com/questions/19388391/number-in-month-exercise-dont-understand-why-im-getting-syntax-error-at-eof