tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

commit 88b1c716953c593219ef9869400b89f8423995c9
parent cbf23bc5693dd52e5db76798fdcd48e3f47fc30f
Author: James Eversole <james@eversole.co>
Date:   Thu, 23 Jan 2025 18:57:59 -0600

Add size demo

Diffstat:
MREADME.md | 3+++
Ademos/size.tri | 19+++++++++++++++++++
Mdemos/toSource.tri | 2+-
3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md @@ -34,6 +34,9 @@ tricu > "Stem" tricu < -- We can even convert a term back to source code (/demos/toSource.tri) tricu < toSource not? tricu > "(t (t (t t) (t t t)) (t t (t t t)))" +tricu < -- or calculate its size (/demos/size.tri) +tricu < size not? +tricu > 12 ``` ## Installation and Use diff --git a/demos/size.tri b/demos/size.tri @@ -0,0 +1,19 @@ +compose = (\f g x : f (g x)) + +succ = y (\self : + triage + 1 + t + (triage + (t (t t)) + (\_ tail : t t (self tail)) + t)) + +size = (\x : + (y (\self x : + compose succ + (triage + (\x : x) + self + (\x y : compose (self x) (self y)) + x)) x 0)) diff --git a/demos/toSource.tri b/demos/toSource.tri @@ -43,4 +43,4 @@ toSource_ = y (\self arg : toSource = (\v : toSource_ v "") exampleOne = toSource true -- OUT: "(t t)" -exampleTwo = toSource not -- OUT: "(t (t (t t) (t t t)) (t t (t t t)))" +exampleTwo = toSource not? -- OUT: "(t (t (t t) (t t t)) (t t (t t t)))"