3 ms·
It is a list node. It's just that you can implement binary trees trivially out of lists.
by dependenttypes 6y ago
It is a list node. It's just that you can implement binary trees trivially out of lists.
- rumanator 6y agoYou got it entirely backwards: a cons cell is a tree node which, as a corner case, can represent branches of a binary tree where the left child node (car) points to a child node value and the right child node (cdr) points to another branch (cons cell or nill).
- dependenttypes 6y agoI indeed got it incorrect but a cons cell is still not a tree node (it can be one though). It is rather just a pair, like (x, y) in haskell or std::pair in C++.
- rumanator 6y agoIf you want to insist and keep pushing a patently false take then you should at least be aware that you're trying to push a personal definition for a well-established concept that contradicts it's definition, origin, use, and purpose. https://wiki.c2.com/?ConsCell https://wiki.c2.com/?ConsCell
- dependenttypes 6y ago(cons 1 2) Yep, definitely looks like a tree rather than a pair... not. What was the point in linking to this c2 topic even if it does not agree with you?
- rumanator 6y ago> Yep, definitely looks like a tree rather than a pair... Node of a binary tree. Either you have problems keeping track of context or you're trolling. Either way I see no point in continuing this conversation. If you have any interest in learning what a cons cell is then there are plenty of resources to go around. If instead you prefer to push personal misconceptions formed in total ignorance then it's fine by me as well.
- dependenttypes 6y ago> Node of a binary tree std::pair is the node of a binary tree, yeah man. Listen, it is okay to be wrong, just admit it and move on. Pressing on it makes you look like an idiot. "oh look, a line segment!" "It's not a line segment, it's a triangle/polygon node" You can surely see how ridiculous this sounds, right?