[racket] filtering syntax
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 18-01-12 13:30, Marijn wrote:
> On 18-01-12 13:05, Veer Singh wrote:
>> Add
>
>> (require (for-syntax syntax/parse))
>
> Right, so after adding (require (for-syntax syntax/parse
> syntax/free-vars)) it works,
>
> Marijn
So after rewriting for syntax-case, this becomes the below, where I
have also inserted a call to internal-definition-context-seal which
was mentioned by the documentation as being required, but causes no
obvious problems when absent. Should it be used here?
Marijn
#lang racket
(provide dependency-graph)
(require (for-syntax syntax/free-vars))
(define-syntax (dependency-graph stx)
(syntax-case stx ()
((_ ((id rule) ...))
(let ((ctx (syntax-local-make-definition-context)))
(syntax-local-bind-syntaxes (syntax->list #'(id ...)) #f ctx)
(internal-definition-context-seal ctx)
(with-syntax
(((dep ...)
(map (lambda (expr)
(free-vars
(local-expand expr 'expression '() ctx)))
(syntax->list #'(rule ...)))))
#''((id . dep) ...))) )))
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk8W6uoACgkQp/VmCx0OL2zwbgCfXCjTo7r+S9aZ5NJdtzzmFeKc
7ooAni52r/VDNJKru2v6+g2Ff8X/6Kw4
=AiLa
-----END PGP SIGNATURE-----