mirror of
https://github.com/anoma/juvix.git
synced 2024-12-14 08:27:03 +03:00
803d2008d9
* remove ≔ from the language and replace it by := * revert accidental changes in juvix input mode * update stdlib submodule * rename ℕ by Nat in the tests and examples * fix shell tests
33 lines
740 B
Plaintext
33 lines
740 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;
|