mirror of
https://github.com/anoma/juvix.git
synced 2024-12-15 01:52:11 +03:00
39a300eaa2
* add a simple positive test * add lambda expressions to microjuvix language * add basic normalization of type aliases * fix test name * normalize only functions on types * normalize when matching * fix type of inductive names * improve detection of normalizing functions * remove obsolete comment * match constructor return type * add test for issue 1333 * fix existing tests * use lambda case * add strong normalization * Add test cases for type aliases and another fix Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
33 lines
724 B
Plaintext
33 lines
724 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;
|