Created
March 28, 2013 21:20
-
-
Save dyoo/5266913 to your computer and use it in GitHub Desktop.
More play with the dynamic evaluation tools
This file contains hidden or 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 | |
(define ns (make-base-namespace)) | |
(define (play module-path) | |
(parameterize ([current-namespace ns]) | |
(dynamic-require module-path #f) | |
(define-values (module-variable-exports module-syntax-exports) | |
(module->exports module-path)) | |
(define phase-0-variable-exports | |
(for/first ([phase+export module-variable-exports] | |
#:when (= (car phase+export) 0)) | |
(cdr phase+export))) | |
(for ([export phase-0-variable-exports]) | |
(define exported-name (car export)) | |
(printf "~s ~s\n" | |
exported-name | |
(dynamic-require module-path exported-name))) | |
(void))) | |
(play 'racket/base) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment