This is the program that transforms a source-code file into native-code binary form. If destination is not given, as in
cf compiles the file foo.scm, producing the file
foo.com. It will also produce foo.bin, foo.bci,
and possibly foo.ext. The corresponding names for R7RS
libraries are foo.sld, foo.comld, foo.binld, and
foo.bcild (libraries never generate .ext files). If you
foo.com (or foo.comld) will be loaded.
If destination is given, it says where the output files should go. If this argument is a directory, they go in that directory, e.g.:
(cf "foo" "../bar/")
will take foo.scm and generate the file ../bar/foo.com. If destination is not a directory, it is the root name of the output:
(cf "foo" "bar")
takes foo.scm and generates bar.com.
About the .bci files: these files contain the debugging
information that Scheme uses when you call
debug to examine
compiled code. When you load a .com file, Scheme remembers where
it was loaded from, and when the debugger (or
pp) looks at the
compiled code from that file, it attempts to find the .bci file
in the same directory from which the .com file was loaded. Thus
it is a good idea to leave these files together.
If this variable is
#f, then printing a compiled procedure
will print the procedure’s name only if the debugging information for
that procedure is already loaded. Otherwise, it will force
loading of the debugging information.
The default value is
sf is the program that transforms a source-code file into binary
SCode form; it is used on machines that do not support native-code
compilation. It performs numerous optimizations that can make your
programs run considerably faster than unoptimized interpreted code.
Also, the binary files that it generates load very quickly compared to
The simplest way to use
sf is just to say:
This will cause your file to be transformed, and the resulting binary file to be written out with the same name, but with the suffix .bin. If you do not specify a suffix on the input file, .scm is assumed.
load, the first argument to
sf may be a list of
filenames rather than a single filename.
sf takes an optional second argument, which is the filename of
the output file. If this argument is a directory, then the output file
has its normal name but is put in that directory instead.