This is probably simple, but can anyone explain why the following pattern matching is unreasonable? It specifies other rules, for example. 1, 0, _ will never match.
let matchTest(n : int) =
let ran = new Random()
let i = ran.Next(0, 2)
match i with
| n -> printfn "%i" n
| 1 -> printfn "1"
| 0 -> printfn "0"
| _ -> printfn "impossible"
The same for this:
let matchTest(n : int) =
let ran = new Random()
let i = ran.Next(0, 2)
let m = n
match i with
| m -> printfn "%i" m
| 1 -> printfn "1"
| 0 -> printfn "0"
| _ -> printfn "impossible"
So why can't it match nor mright here?
source
share