mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-15 22:32:19 +03:00
a972778eab
They don't all pass yet, for minor reasons. Coming shortly... Unfortunately the startup overhead for chez is really noticeable here!
19 lines
333 B
Idris
19 lines
333 B
Idris
data Bool = False | True
|
|
data Nat = Z | S Nat
|
|
|
|
not : Bool -> Bool
|
|
not False = True
|
|
not True = False
|
|
|
|
isZero : Nat -> Bool
|
|
isZero Z = True
|
|
isZero (S k) = False
|
|
|
|
isOdd : Nat -> Bool
|
|
isOdd Z = False
|
|
isOdd (S k) = not (isOdd k)
|
|
|
|
testZ : Nat -> String
|
|
testZ x = if isZero x then "Zero" else
|
|
if isOdd x then "Odd" else "Even"
|