Match in match?

Is there a way to make a match in a match in F #? I noticed that you can make one tail on the other, so ...

match L.Head with | null -> [] | _ -> match N with | 1 -> [L.Head] | _ -> [] 

But is there a way to do this so that a match ending in _ can be placed in the MIDDLE of another match? This seems to give an error ... is there a better way to do this if you need this for your logic? EX:

 match A with | 0 -> match B with | 1 -> 1 | _ -> 0 | _ -> 2 
+4
source share
1 answer

Why not use a tuple match -

 match (A,B) with |0,1 -> 1 |0,_ -> 0 |_, -> 2 
+7
source

Source: https://habr.com/ru/post/1501221/


All Articles