[plt-scheme] load non-exported symbols from a file

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 14 08:28:42 EDT 2008

At Wed, 14 May 2008 12:47:48 +0100, Filipe Cabecinhas wrote:
> Is it possible to load every defined symbol from an R6RS program so I  
> can use use them to do some tests?

An R6RS program is a PLT Scheme module, so you can use reflection
operations like `module->namespace' to get inside the program.

For example, if "ex.ss" contains

  #!r6rs

  (import (rnrs))

  (define one 1)
  (define two 2)

then

  > (require "ex.ss")
  > (define ns (module->namespace "ex.ss"))
  > (eval 'one ns)
  1
  > (eval 'two ns)
  2


Matthew



Posted on the users mailing list.