zainab-ali / pair-tree.el

An Emacs Lisp cons cell explorer
GNU General Public License v3.0
51 stars 3 forks source link

FYI, also called box-and-pointer notation #7

Open dalanicolai opened 3 years ago

dalanicolai commented 3 years ago

Nice idea and nice package!

Maybe you are aware of this already, but in Structure and Interpretation of Computer Programs by Abelson and Sussman, the pair tree is called box-and-pointer notation (or representation). Pair-tree sounds adequate to me too... I just encountered it and thought it might interest you. There are no other reasons for opening this issue.

image

dalanicolai commented 3 years ago

Although it is not really important, I have extended svg.el with marker/arrowhead drawing feature here (I just translated the code from here). Examples of how to use it is in the preliminary comments (just search for arrow). Maybe you are interested...

I have not yet created a merge request yet, but it should be working perfectly fine...

dalanicolai commented 3 years ago

Unfrotunately the arrowheads do not really work, because of how the paths are drawn. Well not so important anyway...

image

The pair-tree-with-arrows.el that results in the image shown above is available here

zainab-ali commented 2 years ago

Thank you very much!

Apologies for the delay. I took a break from Github over April and unfortunately overlooked this.

It's inspiring to see that these diagrams were in SICP too :grinning: . I'm giving it a mention in the readme, as well as the name. "box-and-pointer" gives a the right results on a web search, so it should be helpful to anyone wanting to know more.

As for the arrowheads, I'm working on the code in #8 . I've made them a bit smaller and changed the reference position (refX and refY in the <marker> element) such that the full arrowheads show. As I understand, the reference position of an svg marker is a point within the <marker> viewbox. It's placed at the end of the line for :marker-end. Setting the reference position to the far end of the viewbox instead of the middle overlays the full arrow above the line.

yuuyins commented 1 year ago

i personally find the box-and-pointer diagram much better for understanding the underlying implementation of the data structure / linked list, besides also being what the Elisp info manual uses. honestly, i find this circle diagram confusing. i appreciate the effort, logic and good intentions gone into this package though. thank you!