title: Warning: match nonexhaustive
body: <p>I wrote some sml code with all the base cases I can think of, however i still get this warning. Thus function checks if the first list is a permutation of the second list. Im not sure if it works though i think its entering an infinite loop! </p>
  
  <pre><code>fun isPermutation(nil: int list, nil: int list): bool = true
    | isPermutation(x::nil, nil) = false
    | isPermutation(nil, y::nil) = false
    | isPermutation(x1::nil, x2::nil) = if (x1=x2) then true else false
    | isPermutation(x1::l1, x2::l2) = isPermutation(x1::nil, x2::l2) andalso isPermutation(l1, x2::l2)
  </code></pre>