i have a question about disjoint Matching pattern. The matching pattern is disjoint when each case does not step on other cases.
def func(list: List[Int]): Int = list match {
case Nil => 0
case x::t if (x < func(t)) => x
case x::t => func(t)
}
My question: is "if" statement also counted to check if these cases disjoint is? so if we have a patching pattern like this it means the last case also include the second case and it would not be disjoint anyway . But if i change the last case to
case x::t if (x >= func(t)) => func(t)
would the matching pattern considered disjoint ?