Pattern matching by function call
问题 F# assigns function arguments via pattern matching. This is why // ok: pattern matching of tuples upon function call let g (a,b) = a + b g (7,4) works: The tuple is matched with (a,b) and a and b are available directly inside f. Doing the same with discriminated unions would be equally beneficial, but I cannot get it to done: // error: same with discriminated unions type A = | X of int * int | Y of string let f A.X(a, b) = a + b // Error: Successive patterns // should be separated by spaces