type A =
{
...
id: int;
...
}
I wish i could do this
let Add (x:A) (y:A) =
match x,y with
| {x.id=0,y.id=1} -> ...
And is there any trick to define the function if i don’t care about the order of x and y (so that the function is symmetric) also i don’t mind whether the parameter is a tuple (x,y) or a higher order function x,y
If you only care about a field, do pattern matching directly on it. And you can use Or pattern to have a symmetric function.