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

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Wed Mar 14 17:22:10 EDT 2012

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?

Posted on the users mailing list.