Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So a given function would be reprsented by an unlabeled tree, and its result calculated by applying rules which transform the source-tree into a binary tree?

Then how do I "call" such a tree with some specific arguments? Do I have to create a new tree that represents both the function, and the arguments it is called with?

How do I represent numbers, and strings, and arrays?



Presumably you could implement Church numerals [0] or something similar in the tree calculus.

[0] https://en.wikipedia.org/wiki/Church_encoding


Timur Latypoff's page (elsewhere in this thread but also: https://latypoff.com/tree-calculus-visualized/ ) shows a graphical view of this; you get to lists first—easy because tree structure is native here—and then a (natural) number is just a list of booleans, of arbitrary length, least significant first. Very elegant.


Cool, so Church Encoding of numbers is not needed after all. Seems much more simple to do as you describe, numbers are lists of bits. And that is how it is in computer memory too.

But, I thought the nodes of the tree in Tree Calculus were supposed to be "unlabeled". How can they then be booleans?

Ah, a short read through the link you provided explaines it simply. Thanks.


The specification talks about numbers, strings, lists.

The playground has concrete, runnable (bash, JS) examples.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: