I have this code:
fun all_except_option2(str : string, strlst : string list) =
let fun all_except_option([], result) = NONE
| all_except_option(str::T, result) = SOME(List.rev(result) @ T)
| all_except_option(H::T, result) =all_except_option(T, H::result)
in
all_except_option(strlst, [])
end
and the compiler says:
hw2provided.sml:22.13-24.70 Error: match redundant (nil,result) => ... (str :: T,result) => ... --> (H :: T,result) => ...
I handle this already with "case of" statement but my question is way the language dont do pattern matching with str (from above) ? why the compiler think str is a like H.