[racket] filtering syntax

From: Marijn (hkBst at gentoo.org)
Date: Wed Jan 18 07:06:24 EST 2012

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

On 18-01-12 11:36, Veer Singh wrote:
> This seems to work (blind hack),

Unfortunately it doesn't work:
_: wildcard not allowed as an expression in: (_ ((id:id expr:expr ...)
...))

in line 3 of the following:

> (define-syntax (depgraph stx) (syntax-parse stx [(_ ((id:id
> expr:expr ...) ...))
> 
> (define id-lst (syntax->list #'(id ...))) (define ctx
> (syntax-local-make-definition-context)) (syntax-local-bind-syntaxes
> id-lst #f ctx) (with-syntax ([p #'((lambda () expr ...) ...)]) 
> (define p-lst (syntax->list #'p)) (define vars (map (lambda (e) 
> (free-vars (local-expand e 'expression '() ctx))) p-lst)) 
> (with-syntax ([((f ...) ...) vars]) #''((id (f ...)) ...)))]))
> 
> 
> (define simple-arith (depgraph ((a #f) (b (* 3 a)) (c (+ 5 a b)) (d
> (let ((a 9)) (- c a))) )))
> 
> simple-arith ;((a ()) (b (a)) (c (b a)) (d (c)))
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8WtcAACgkQp/VmCx0OL2xvBQCgxxM7UrjQqXhK/djusC9apPey
CrYAn19TFKmxRsTOnzVZoknhdrY3BuJC
=6bty
-----END PGP SIGNATURE-----

Posted on the users mailing list.