VAL keyword within IF condition won't allow reassignment in SML
问题 Given this following code (which does not work): fun func() = val decimal = 0 (* the final result *) val multiple = 0 (* keeps track of multiples, eg. In XXV, X would be a multiple *) val current = 0 (* the digit currently being processed *) val top = 0 (* value of the last element in the list *) val last_add = 0 (* the last digit that wasn't a multiple, or subtraction operation *) val last_sub = 0 val problem = 0 (* if value is 1 then there is a problem with the input *) val myList = [1,2,3