3 ms·
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? T
by galaxyLogic 2y ago
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?
- ryandv 2y agoPresumably you could implement Church numerals [0] or something similar in the tree calculus. [0] https://en.wikipedia.org/wiki/Church_encoding https://en.wikipedia.org/wiki/Church_encoding
- blahedo 2y agoTimur Latypoff's page (elsewhere in this thread but also: https://latypoff.com/tree-calculus-visualized/ 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.
- galaxyLogic 2y agoCool, 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.
- quchen 2y agoThe specification talks about numbers, strings, lists. The playground has concrete, runnable (bash, JS) examples.