chickadee » s48-modules » include-relative

(include-relative filename)syntax

This includes filename just like include would, but if you use include-relative inside that file, it will include files relative to the directory in which filename is located (include would instead just try to find the file relative to the topmost file you're compiling).

This macro must be used to include Scheme 48 module/package files which use files declarations to load external files.

For example, this code:

;; file: /rootpath/foo.scm
(include "bar/qux.scm")
;; file: /rootpath/bar/qux.scm
(include "mooh/blah.scm")

Would fail to load /rootpath/bar/mooh/blah.scm. Instead, it gives an error because it is trying to load /rootpath/mooh/blah.scm.

Whereas this would work:

;; file: /rootpath/foo.scm
(use s48-modules)
(include-relative "bar/qux.scm")
;; file: /rootpath/bar/qux.scm
(include-relative "mooh/blah.scm")