Closed m-spitfire closed 1 year ago
match fancy_list with
| x1 :: x2 :: x3 :: x4 :: [] -> do_something_useful
| _ -> failwith "the length of list must be 4"
Oh, I was doing that and returning x1;x2;x3;x4
list from match, then matching again as value of match expression, then I realized I can return a tuple and pattern match on that. Thanks for giving me insight!
Name: Murad Bashirov
Hello. Is there a way to assert the list length, so when I pattern match it, so it doesn't give me the warning "pattern-matching is not exhaustive". I have tried
But it doesn't get rid of the warning.