[racket] filtering syntax

From: Marijn (hkBst at gentoo.org)
Date: Mon Jan 16 07:57:19 EST 2012

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13-01-12 15:52, Sam Tobin-Hochstadt wrote:
> On Fri, Jan 13, 2012 at 9:23 AM, Matthias Felleisen 
> <matthias at ccs.neu.edu> wrote:
>> compute the free variables with a simple recursive pass over core
>> syntax,
> 
> Note that there's code to do this here: 
> http://pre.racket-lang.org/docs/html/syntax/syntax-helpers.html
> 

I'm having some trouble using this code. I would expect something like:


#lang racket

(require (for-syntax syntax/free-vars))

(define-syntax (depgraph stx)
  (syntax-case stx ()
    ((_ ((id rule) ...))
     (with-syntax (((dep ...) (free-vars (expand #'(rule ...)))))
     #`((id . dep) ...)) )))

(define simple-arith
  (depgraph
   ((a #f)
    (b (* 3 a))
    (c (+ 5 a b))
    (d (let ((a 9)) (- c a))) )))

simple-arith


to work, but expand complains about the unbound a in the rule for b.

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8UHq8ACgkQp/VmCx0OL2wScwCdFaR7fSv9XF8eblXDaNMTO9Yo
fHsAnRDxwppSqljz2roh385i/mXhf7Ct
=y/4U
-----END PGP SIGNATURE-----


Posted on the users mailing list.