-
-
Save cannorin/8af6ae964f3dea692c44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 擬似コードです | |
type CmpResult = | |
True of Int | False | |
let > (x : CmpResult, y : CmpResult) : CmpResult = | |
match (x, y) with | |
(True m, True n) when Int.> m n -> CmpResult.True m | |
| (_, _) -> CmpResult.False | |
let < (x : CmpResult, y : CmpResult) : CmpResult = | |
match (x, y) with | |
(True m, True n) when Int.< m n -> CmpResult.True n | |
| (_, _) -> CmpResult.False | |
let == (x : CmpResult, y : CmpResult) : CmpResult = | |
match (x, y) with | |
(True m, True n) when Int.== m n -> CmpResult.True m | |
| (_, _) -> CmpResult.False | |
let != (x : CmpResult, y : CmpResult) : CmpResult = | |
match (x, y) with | |
(True m, True n) when Int.!= m n -> CmpResult.True m | |
| (_, _) -> CmpResult.False | |
(1 < 2) < 3 // CmpResult.True 3 | |
(2 < 1) < 3 // CmpResult.False | |
(1 == 1) == 1 // CmpResult.True 1 | |
(1 != 2) != 3 // CmpResult.True 1 | |
(1 == 2) != 3 // CmpResult.False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment