James Eversole 60a9e3c1ee Expansion of testing suite to cover incl. library
Expands the testing suite to verify behavior of provided library
functions. Updates the README further for clarification on important
concepts.
2024-12-29 10:28:32 -06:00
2024-12-27 08:17:06 -06:00
2024-12-18 18:59:07 -06:00
2024-12-29 08:29:25 -06:00
2024-12-18 19:15:56 -06:00
2024-12-18 18:59:07 -06:00
2024-12-29 08:29:25 -06:00

tricu

Introduction

tricu (pronounced like the words "tree-shoe" in English) is a language that I'm working on to investigate Tree Calculus.

tricu is the word for "tree" in Lojban ((x1) is a tree of species/cultivar (x2)). This project was named "sapling" until I discovered the name is already being used for other (completely unrelated) programming language development projects.

tricu offers minimal syntax sugar yet manages to provide a complete, intuitive, and familiar programming environment. There is great power in simplicity. tricu offers:

  1. t operator behaving by the rules of Tree Calculus
  2. Function definitions/assignments
  3. Lambda abstractions eliminated to Tree Calculus forms
  4. List, Number, and String literals
  5. Parentheses intuitively grouping function application

These basic features move us cleanly out of the turing tarpit territory that you may find yourself in if you try working only with the t operator.

What does it look like?

-- Anything after `--` on a line is a comment
-- We can define functions or "variables" as Tree Calculus values
false = t 
_ = t
true = t t
-- We can define functions as lambda expressions that are eliminated to Tree
-- Calculus terms.
id = (\a : a) -- `id` evaluates to the TC form of: t (t (t t)) t
triage = (\a b c : t (t a b) c)
-- Intensionality! We can inspect program structure, not just inputs/outputs:
test = triage "Leaf" (\_ : "Stem") (\_ _ : "Fork")

-- REPL
-- `tricu <` is the input prompt
-- `tricu >` is the Tree Calculus form output. Most are elided below.
-- `READ -:` is an attempt to interpret the TC output as strings/numbers.
tricu < test t
tricu > Fork (Fork Leaf (Fork ...) ... ) 
READ -: "Leaf"
tricu < test (t t)
READ -: "Stem"
tricu < test (t t t)
READ -: "Fork"
tricu < map (\i : listConcat i " is super cool!") [("Tree Calculus") ("Intensionality") ("tricu")]
READ -: ["Tree Calculus is super cool!", "Intensionality is super cool!", "tricu is super cool!"]

Installation

You can easily build and/or run this project using Nix.

  • Build REPL binary: nix build git+https://git.eversole.co/James/tricu
  • Run REPL: nix run git+https://git.eversole.co/James/tricu

Acknowledgements

Tree Calculus was discovered by Barry Jay.

treecalcul.us is an excellent website with an intuitive playground created by Johannes Bader that introduced me to Tree Calculus. If tricu sounds interesting but compiling this repo sounds like a hassle, you should check out his site.

Description
A micro-language for exploring Tree Calculus
Readme
Languages
Haskell 97%
Nix 3%