number_in_month exercise (Error in SML function to build a list of integers from a list of tuples)
问题 val test1 = [(1,5,3),(3,5,2),(3,4,5)] fun number_in_month dates_and_month = case dates_and_month of (x,y,z)::xs' => y :: number_in_month xs' This code produces the following error when I run in the REPL with test1: uncaught exception Match [nonexhaustive match failure] raised at: hw1pm.sml:28.49 Any clue why? 回答1: It did not know what do when the list was empty. Working code: fun number_in_month dates_and_month = case dates_and_month of [] => [] | (x,y,z)::xs' => y :: number_in_month xs' 回答2: