lib/ubik/include.ss
(library (ubik include)
  (export include)
  (import (for (rnrs base) (meta 0) (meta 1))
          (for (rnrs syntax-case) (meta 0) (meta 1))
          (for (rnrs io simple) (meta 1)))

  (define-syntax include
    (lambda (x)
      (define read-file
        (lambda (fn k)
          (let ((p (open-input-file fn)))
            (let f ((x (read p)))
              (if (eof-object? x)
                  (begin (close-input-port p) '())
                  (cons (datum->syntax k x)
                        (f (read p))))))))
      (syntax-case x ()
        ((k filename)
         (let ((fn (syntax->datum (syntax filename))))
           (with-syntax (((exp ...)
                          (read-file fn (syntax k))))
             (syntax (begin exp ...)))))))))