Created
October 26, 2012 21:39
-
-
Save dyoo/3961723 to your computer and use it in GitHub Desktop.
playing with expand and bound-identifier=?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require (for-template '#%kernel)) | |
(define a-stx #'(define-values (f) (#%plain-lambda (x) | |
(let-values ([(x) 42]) x)))) | |
(syntax-case a-stx () | |
[(d-v (fun) (lam (id-0) (l-v (((id-1) v)) id-2))) | |
(begin | |
(printf "free-identifier=? ~s\n" (free-identifier=? #'id-1 #'id-2)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-1 #'id-2)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-0 #'id-1)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-0 #'id-2)))]) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(newline)(newline) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(define an-expanded-stx (parameterize ([current-namespace (make-base-namespace)]) | |
(expand a-stx))) | |
(syntax-case an-expanded-stx () | |
[(d-v (fun) (lam (id-0) (l-v (((id-1) v)) id-2))) | |
(begin | |
(printf "free-identifier=? ~s\n" (free-identifier=? #'id-1 #'id-2)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-1 #'id-2)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-0 #'id-1)) | |
(printf "bound-identifier=? ~s\n" (bound-identifier=? #'id-0 #'id-2)))]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment