Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let (|A|B|C|) c =
- if (c = 'a') then A
- else if (c = 'b') then B
- else C
- let (|A|B|D|) c =
- if (c = '1') then A
- else if (c = '2') then B
- else D
- let check myvar =
- match myvar with
- | A -> printf "match An"
- | n -> printf "match other %An" n
- check 'x' // match other 'x'
- check 'a' // match other 'a' !!
- check '1' // match A
- module Pat1 =
- let (|A|B|C|) c =
- if (c = 'a') then A
- else if (c = 'b') then B
- else C
- module Pat2 =
- let (|A|B|D|) c =
- if (c = '1') then A
- else if (c = '2') then B
- else D
- let check myvar =
- match myvar with
- | Pat1.A -> printf "match An"
- | n -> printf "match other %An" n
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement