Yes, but only in a fairly complex way. Your rendering function would have to call out to graphviz, get the results back as a png, use read-bitmap to get the png back into Racket, create an image snip and then insert that into the editor, using the more complex version of the `pp` argument.
Here's an example. Robby #lang racket/gui (define (dot-render t) (define-values (dot-input-in dot-input-out) (make-pipe)) (define-values (dot-output-in dot-output-out) (make-pipe)) (thread (λ () (define n 0) (define (next) (set! n (+ n 1)) (format "x~a" n)) (fprintf dot-input-out "digraph {\n") (let loop ([t t]) (define me (next)) (match t [`(,e1 ,e2 ,e3) (fprintf dot-input-out " ~a [label=\"\" width=.2 height=.2]\n" me) (fprintf dot-input-out " ~a -> ~a\n" me (loop e1)) (fprintf dot-input-out " ~a -> ~a\n" me (loop e2)) (fprintf dot-input-out " ~a -> ~a\n" me (loop e3)) me] [_ (fprintf dot-input-out " ~a [shape=point]\n" me) me])) (fprintf dot-input-out "}\n") (close-output-port dot-input-out))) (thread (λ () (parameterize ([current-output-port dot-output-out] [current-input-port dot-input-in]) (system "/usr/local/bin/dot -T png")) (close-output-port dot-output-out))) (read-bitmap dot-output-in)) (require redex) (define-language L (e ::= (e e e) ⊥)) (define red (reduction-relation L (--> e (e ⊥ ⊥)) (--> e (⊥ e ⊥)) (--> e (⊥ ⊥ e)))) (traces red (term ⊥) #:pp (λ (t port n txt) (send txt insert (make-object image-snip% (dot-render t))))) On Wed, Sep 23, 2015 at 12:05 PM, Anton Podkopaev <podkoav...@gmail.com> wrote: > Hello! > > I'm working on an operational semantics using PLT Redex. I use `traces` a lot > to debug my semantics. To represent states in a nice way I'm using a pretty > printer, but I want more -- I want to use Graphviz. Is it somehow possible to > call Graphviz from my pretty printer, and incorporate a result of rendering > into a pretty-printed text? > > BR, > Anton Podkopaev, PhD student, SPbSU > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.