(: Aiche Tee Tee Pee :)
Perhaps the first webserver in Tree Calculus? Sure, it's married to a Haskell IO runtime... but we're managing all of the actual webserver semantics in tricu! This includes a demo Arboricx application server that is capable of storing and serving bundles.
This commit is contained in:
48
lib/base.tri
48
lib/base.tri
@@ -121,6 +121,18 @@ maybe? = matchMaybe false (_ : true)
|
||||
-- Basic arithmetic
|
||||
-- ---------------------------------------------------------------------------
|
||||
|
||||
ifLazy = (cond thenK elseK :
|
||||
matchBool
|
||||
(thenK t)
|
||||
(elseK t)
|
||||
cond)
|
||||
|
||||
andLazy? = (a bK :
|
||||
ifLazy
|
||||
a
|
||||
bK
|
||||
(_ : false))
|
||||
|
||||
pred = y (self : triage
|
||||
0
|
||||
(_ : 0)
|
||||
@@ -146,19 +158,35 @@ add = y (self x y :
|
||||
x)
|
||||
|
||||
sub = y (self a b :
|
||||
matchBool
|
||||
a
|
||||
(self (pred a) (pred b))
|
||||
(isZero? b))
|
||||
ifLazy
|
||||
(isZero? b)
|
||||
(_ : a)
|
||||
(_ : self (pred a) (pred b)))
|
||||
|
||||
lt? = a b : not? (isZero? (sub b a))
|
||||
lte? = a b : isZero? (sub a b)
|
||||
lte? = y (self a b :
|
||||
ifLazy
|
||||
(isZero? a)
|
||||
(_ : true)
|
||||
(_ :
|
||||
ifLazy
|
||||
(isZero? b)
|
||||
(_ : false)
|
||||
(_ : self (pred a) (pred b))))
|
||||
|
||||
gte? = a b :
|
||||
lte? b a
|
||||
|
||||
lt? = a b :
|
||||
and? (lte? a b) (not? (equal? a b))
|
||||
|
||||
gt? = a b :
|
||||
lt? b a
|
||||
|
||||
mul = y (self a b :
|
||||
matchBool
|
||||
0
|
||||
(add a (self a (pred b)))
|
||||
(isZero? b))
|
||||
ifLazy
|
||||
(isZero? b)
|
||||
(_ : 0)
|
||||
(_ : add a (self a (pred b))))
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- Result combinators
|
||||
|
||||
Reference in New Issue
Block a user