Next: World Images, Previous: The Read-Eval-Print Loop, Up: Using Scheme [Contents][Index]
To load files of Scheme code, use the procedure load
:
Filename may be a string naming a file, or a list of strings naming multiple files. Environment, if given, is the environment to evaluate the file in; if not given the current REPL environment is used.
Syntax-table is no longer used and if supplied will be ignored.
The optional argument purify? is a boolean that says whether to
move the contents of the file into constant space after it is loaded but
before it is evaluated. This is performed by calling the procedure
purify
(see Garbage Collection). If purify? is given
and true, this is done; otherwise it is not.
load
determines whether the file to be loaded is binary or source
code, and performs the appropriate action. By convention, files of
source code have a pathname type of "scm"
, and files of binary
SCode have pathname type "bin"
. Native-code binaries have
pathname type "com"
. (See the description of
pathname-type
in Components of Pathnames in MIT/GNU Scheme Reference Manual.)
All pathnames are interpreted relative to a working directory, which is
initialized when Scheme is started. The working directory can be
obtained by calling the procedure pwd
or modified by calling the
procedure cd
; see Working Directory in MIT/GNU
Scheme Reference Manual. Files may be loaded when Scheme first starts;
see the --load command-line option for details.
Loads the option specified by symbol; if already loaded, does
nothing. Returns symbol; if there is no such option, an error is
signalled. However, if no-error? is specified and true, no error
is signalled in this case, and #f
is returned.
A number of built-in options are defined:
compress
Support to compress and uncompress files. Undocumented; see the source file runtime/cpress.scm. Used by the runtime system for compression of compiled-code debugging information.
format
The format
procedure. See Format in MIT/GNU Scheme
Reference Manual.
ordered-vector
Support to search and do completion on vectors of ordered elements. Undocumented; see the source file runtime/ordvec.scm.
rb-tree
The red-black tree data type. See Red-Black Trees in MIT/GNU Scheme Reference Manual.
regular-expression
Support to search and match strings for regular expressions. See Regular Expressions in MIT/GNU Scheme Reference Manual.
stepper
Support to step through the evaluation of Scheme expressions. Undocumented; see the source file runtime/ystep.scm. Used by the Edwin command step-expression.
subprocess
Support to run other programs as subprocesses of the Scheme process. Undocumented; see the source file runtime/process.scm. Used extensively by Edwin.
synchronous-subprocess
Support to run synchronous subprocesses. See Subprocesses in MIT/GNU Scheme Reference Manual.
wt-tree
The weight-balanced tree data type. See Weight-Balanced Trees in MIT/GNU Scheme Reference Manual.
In addition to the built-in options, you may define other options to be
loaded by load-options
by modifying the file optiondb.scm
on the library path. An example file is included with the distribution;
normally this file consists of a series of calls to the procedure
define-load-option
, terminated by the expression
(further-load-options standard-load-options)
Each thunk must be a procedure of no arguments. Defines the load
option named symbol. When the procedure load-option
is
called with symbol as an argument, the thunk arguments are
executed in order from left to right.
Next: World Images, Previous: The Read-Eval-Print Loop, Up: Using Scheme [Contents][Index]