mirror of
https://github.com/anoma/juvix.git
synced 2024-12-14 17:32:00 +03:00
3b3ea45da9
* Renaming MiniJuvix to Juvix * Make Ormolu happy * Make Hlint happy * Remove redundant imports * Fix shell tests and add target ci to our Makefile * Make pre-commit happy
33 lines
726 B
Plaintext
33 lines
726 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 1)
|
|
>> put-str "even 4: " >> put-str-ln (checkEven 4)
|
|
>> put-str "even 9: " >> put-str-ln (checkEven 9)
|
|
>> put-str "odd 1: " >> put-str-ln (checkOdd 1)
|
|
>> put-str "odd 4: " >> put-str-ln (checkOdd 4)
|
|
>> put-str "odd 9: " >> put-str-ln (checkOdd 9)
|
|
|
|
end;
|