Created
August 6, 2020 04:52
-
-
Save OldPanda/a00c33e4465613f9bf5c3dab78d5bb48 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
let rec is_odd_pos(num: int): bool = | |
if num = 0 then false | |
else is_even_pos(num - 1) | |
and is_even_pos(num: int): bool = | |
if num = 0 then true | |
else is_odd_pos(num - 1);; | |
let rec is_odd_neg(num: int): bool = | |
if num = 0 then false | |
else is_even_neg(num + 1) | |
and is_even_neg(num: int): bool = | |
if num = 0 then true | |
else is_odd_neg(num + 1);; | |
let is_odd(num: int): bool = | |
if num >= 0 then (is_odd_pos num) | |
else (is_odd_neg num);; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment