views:

653

answers:

3

Hello all,

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!

+2  A: 

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.

Laurence Gonsalves
Hi, thanks a lot for your reply. I was hoping to print straight to the console, but your suggestion sounds much more flexible for large trees. Thanks again for your time!
wvoq
+3  A: 

If you do decide to go with GraphViz, check out http: //common-lisp.net/project/cl-graphviz (new users not allowed to enter proper hyperlinks :/ )

jlf
Thanks, much obliged.
wvoq
+7  A: 
Rainer Joswig
Awesome, SDRAW was exactly what I was looking for: a clean way to represent nested cons cells. Thanks again.
wvoq