Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created March 28, 2013 21:20
Show Gist options
  • Save dyoo/5266913 to your computer and use it in GitHub Desktop.
Save dyoo/5266913 to your computer and use it in GitHub Desktop.
More play with the dynamic evaluation tools
#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