pow, even, odd, min, max

This commit is contained in:
2026-08-31 09:01:02 -05:00
parent dfcaf14404
commit 14b78847f9
3 changed files with 153 additions and 0 deletions

View File

@@ -246,6 +246,24 @@ mod = y (self a b :
(_ : a)
(_ : self (sub a b) b)))
pow = y (self a b :
ifLazy
(isZero? b)
(_ : 1)
(_ : mul a (self a (pred b))))
even? n = (triage
true
(_ : false)
(bit _ : isZero? bit)
n)
odd? = (n : not? (even? n))
min = (a b : ifLazy (lte? a b) (_ : a) (_ : b))
max = (a b : ifLazy (lte? a b) (_ : b) (_ : a))
-- ---------------------------------------------------------------------------
-- Result combinators
-- ---------------------------------------------------------------------------