LispTree: Draw Maxima objects as trees (using Lisp)My main page on Maxima is here.
1. A problemRun this in Maxima:
The output of the fundef will be:
The "?", that indicates that the second "format" is a Lisp symbol, disappeared! We can make it appear by setting lispdisp, but that's not obvious... 2. A solutionLispTree can display the result of the fundef above in several tree-like formats. Here are some of them:
The last one is called a "Lispy tree". 3. Trying itThe code of LispTree is composed of three files:
Here's one way to try it. Run this - you can ignore the lines with the red stars if you don't use eev/eepitch:
You will get something like this screenshot: The demo above was taken from here:
4. The innardsThe last line of the demo above was a "lisptreeq(2+3)" that "quoted" its argument instead of simplifying it. That was only possible because the lisptreeq is a macro, and it ran a block with "simp:false". This is a trick that took me a long time to get right, and LispTree is full of other tricks like that. I prefer to think that LispTree is
See here. 5. Tests in commentsLispTree is full of tests in comments. Some of them, but not all, are test blocks. See show-conses.el and this e-mail about it. 6. EtcLispTree supersedes LuaTree. More soon! |