How to visualise arbitrary tree?
for example:
(define T1 \'(and (or x1 x2)(or x3 x4 x5)))
or one generated with:
(define fun
You can do something like this to visualize arbitrarily sized trees:
(require pict
pict/tree-layout)
(define (draw tree)
(define (viz tree)
(cond
((null? tree) #f)
((not (pair? tree))
(tree-layout #:pict (cc-superimpose
(disk 30 #:color "white")
(text (symbol->string tree)))))
((not (pair? (car tree)))
(apply tree-layout (map viz (cdr tree))
#:pict (cc-superimpose
(disk 30 #:color "white")
(text (symbol->string (car tree))))))))
(if (null? tree)
#f
(naive-layered (viz tree))))
For example, using the lists you provided:
(define t1 '(and (or x1 x2) (or x3 x4 x5)))
(define t2 '(or (if A1 (and A1 (not (if D1 (and A0 A0) (or A0 A0)))) (or A0 A0)) D0))