This question probably has an embarrassingly simple answer, but is there a Right Way to format/draw trees in Common Lisp? I've tried a few books as well as googling about, but the problem seems to fall between the cracks of the search terms.
Thanks in advance!
What kind of trees do you want to draw?
SDRAW draws cons cell structures to a terminal. Similar: Draw Cons Tree.
If you have McCLIM, CLIM or a Lisp Machine, you can call the CLIM function CLIM:FORMAT-GRAPH-FROM-ROOT or CLIM:FORMAT-GRAPH-FROM-ROOTS.
If you use LispWorks, there is a graph pane.
If you want to draw plants use this one: L-Lisp.
If you do decide to go with GraphViz, check out http://common-lisp.net/project/cl-graphviz
If you don't find a better solution, I'd be inclined to emit a .dot file and then feed it to one of the Graphviz tools (like dot). The file format is really simple, and the tools can generate a variety of formats including PNG, SVG, PostScript and even image maps (for creating clickable graphs on web pages).
This approach probably only works for you if you want these graphs for your own use (eg: debugging) or you're generating them on a server. Calling out to a separate tool in a client app might have usability and/or licensing issues.
This isn't really a common-lisp specific solution, but I've used this approach from a few languages in the past.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With