tricu/demos/size.tri
James Eversole 87aed72ab2
All checks were successful
Test, Build, and Release / test (push) Successful in 1m43s
Test, Build, and Release / build (push) Successful in 1m16s
# Modules
Basic implementation of a module system including tests.
2025-01-27 16:04:04 -06:00

26 lines
379 B
Plaintext

!module Size
!import "lib/base.tri" Lib
main = size size
compose = \f g x : f (g x)
succ = Lib.y (\self :
Lib.triage
1
t
(Lib.triage
(t (t t))
(\_ Lib.tail : t t (self Lib.tail))
t))
size = (\x :
(Lib.y (\self x :
compose succ
(Lib.triage
(\x : x)
self
(\x y : compose (self x) (self y))
x)) x 0))