Running a top-level R6RS program under Larceny
One way in which I'll frequently be using the Scheme language processors that I've installed is to run a top-level Scheme program that imports libraries that I create as well as standard R6RS libraries. The mechanics of this process vary from one language processor to another. Indeed, the author of the Larceny user manual notes that “[t]he R6RS standard does not specify any way for a top-level program to define its own libraries.” As a result, R6RS language processors that permit this are obliged to extend the standard, so one would expect to find differences.
I created a directory called /home/stone/Projects/AFP/r6rs-testing and placed in it two files. One, greeting.sls, defines an R6RS library; apart from comments, it contains
(library (greeting (0 0))
(export hello)
(import (rnrs base (6))
(rnrs io simple (6)))
(define hello
(lambda ()
(display "Hello, world!")
(newline))))
The other file, top-level-greeter.ss, imports the greeting library and invokes its procedure:
(import (greeting)) (hello)
If the current working directory is the one containing these two files, the shell command
larceny -r6rs -path . -program top-level-greeter.ss
runs the top-level greeter. The -path command-line option takes a colon-separated list of directories in which Larceny is to search for libraries.