1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 17:32:00 +03:00
juvix/tests/positive/MiniC/MutuallyRecursive/Input.juvix

33 lines
748 B
Plaintext

module Input;
open import Prelude;
odd : Nat → Bool;
even : Nat → Bool;
odd zero ≔ false;
odd (suc n) ≔ even n;
even zero ≔ true;
even (suc n) ≔ odd n;
check : (Nat → Bool) → Int → String;
check f x ≔ boolToStr (f (intToNat x));
checkEven : Int → String;
checkEven ≔ check even;
checkOdd : Int → String;
checkOdd ≔ check odd;
main : Action;
main ≔ put-str "even 1: " >> put-str-ln (checkEven Int_1)
>> put-str "even 4: " >> put-str-ln (checkEven Int_4)
>> put-str "even 9: " >> put-str-ln (checkEven Int_9)
>> put-str "odd 1: " >> put-str-ln (checkOdd Int_1)
>> put-str "odd 4: " >> put-str-ln (checkOdd Int_4)
>> put-str "odd 9: " >> put-str-ln (checkOdd Int_9)
end;