[racket] does render-term or term->pict work in a metafunction?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Mar 14 18:06:12 EDT 2012

What do you want to do here? (What you have written suggests that
you're writing a metafunction that returns a pict, which would mean
that the terms in your language are being represented as Racket-level
picts (instead of the usual Racket-level sexpressions).)

Anyways, if you want to render a term, you have to use lw->pict and
to-lw. It is more complex than it needs to be.

Also, if no one has pointed you there yet, the git head has a redex
tutorial now that includes some typesetting. (You'll find more in the
SEwPR book, which Matthias may have a copy to lend you.)


2012/3/14 Stephen Chang <stchang at ccs.neu.edu>:
> Is there a way in redex to convert an arbitrary term to a pict?
> I have this language:
> #lang racket
> (require redex)
> (define-language L
>  (e (λ x e) (e e) x)
>  (x variable-not-otherwise-mentioned))
> (define-metafunction L
>  [(x->pict x) ,(render-term L x #f)])
> and (term (x->pict x)) and (term (x->pict y)) both return a pict of x
> because render-term is a macro so x is treated as syntax and not as a
> pattern variable. Is there a way in redex to do what what I want?
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Posted on the users mailing list.