2024-12-28 21:58:52 -06:00
2024-12-27 08:17:06 -06:00
2024-12-18 18:59:07 -06:00
2024-12-18 19:41:12 -06:00
2024-12-18 19:15:56 -06:00
2024-12-28 21:58:52 -06:00
2024-12-18 18:59:07 -06:00

sapling

Introduction

sapling is a "micro-language" that I'm working on to investigate Tree Calculus .

It offers a minimal amount of syntax sugar:

  • t operator behaving by the rules of Tree Calculus
  • Function ("variable") definitions
  • Lambda abstractions
  • List, Number, and String literals (WIP)

This is an active experimentation project by someone who has no idea what they're doing.

What does it look like?

false      = t
_          = t
true       = t t
id         = (\a : a)
triage     = (\a b c : t (t a b) c) 
match_bool = (\ot of : triage of (\_ : ot) t)
and        = match_bool id (\_ : false)
if         = (\cond then else : t (t else (t t then)) t cond)
triage     = (\a b c : t (t a b) c)
test       = triage "leaf" (\_ : "stem") (\_ _ : "fork")

-- The REPL outputs the tree form results by default; they are elided here.
sapling < test t
DECODE -: "leaf"
sapling < test (t t)
DECODE -: "stem"
sapling < test (t t t)
DECODE -: "fork"
sapling < map (\i : listConcat i " is super cool!") [("He") ("She") ("Everybody")]
DECODE -: ["He is super cool!", "She is super cool!", "Everybody 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/sapling
  • Run REPL: nix run git+https://git.eversole.co/James/sapling

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 sapling 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%