I wrote the following example, in an attempt to experiment with R7RS libraries in Chibi Scheme 0.5.3:
(define-library (example hello)
(export hello-world)
(import (scheme base))
(begin
(define (hello-world) "hello, world")))
(import (scheme write)
(example hello))
(write (hello-world))
Unfortunately when executed, it generates an error about an undefined variable:
$ chibi-scheme hello.scm
ERROR: undefined variable: hello-world
I must be making a simple mistake but don't see it. Any ideas?
Turns out it was a simple mistake - according to the Module System section of the user guide, the file name must match the module name:
The definition of the module (foo bar baz) is searched for in the file "foo/bar/baz.sld".
So in this case the above library definition needs to be added to example/hello.sld
and the import section needs to be extracted into a new .scm
file (or input on the REPL, etc).
Anyway, a trivial solution but maybe it will be of help to someone else out there...