This chapter describes Guile functions that are concerned with loading
and evaluating Scheme code at run time. R4RS Scheme, because of strong
differences in opinion among implementors, only provides a load
function. There are many useful programs that are difficult or
impossible to write without more powerful evaluation procedures, so we
have provided some.
[FIXME: This needs some more text on the difference between procedures, macros and memoizing macros. Also, any definitions listed here should be double-checked by someone who knows what's going on. Ask Mikael, Jim or Aubrey for help. -twp]
proc
. By
convention, if a procedure contains more than one expression and the
first expression is a string constant, that string is assumed to contain
documentation for that procedure.
#t
if obj is a regular macro, a memoizing macro or a
syntax transformer.
syntax
, macro
or macro!
,
depending on whether obj is a syntax tranformer, a regular macro,
or a memoizing macro, respectively. If obj is not a macro,
#f
is returned.
copy-tree
recurses down the
contents of both pairs and vectors (since both cons cells and vector
cells may point to arbitrary objects), and stops recursing when it hits
any other object.
(eval exp)
is
equivalent to (eval2 exp *top-level-lookup-closure*)
.
#t
if sym is defined in the top-level environment.
end-of-file
error is
signalled.
%load-hook
is defined, it should be bound to a procedure
that will be called before any code is loaded. See documentation for
%load-hook
later in this section.
#f
. Filenames may have any of the optional extensions in the
%load-extensions
list; %search-load-path
will try each
extension automatically.
primitive-load
is called. If this
procedure is defined, it will be called with the filename argument that
was passed to primitive-load
.
(define %load-hook (lambda (file) (display "Loading ") (display file) (write-line "...."))) => undefined (load-from-path "foo.scm") -| Loading /usr/local/share/guile/site/foo.scm....
%search-load-path
tries each of these extensions when looking for
a file to load. By default, %load-extensions
is bound to the
list ("" ".scm")
.
Go to the first, previous, next, last section, table of contents.