How to export the same code as both an R6RS and R7RS library

69 Views Asked by At

I have written some procedures that I want to package as both an R6RS library and an R7RS library. The procedures are in a file named mylib.scm:

(define (multiplier n)  ; Private
  (lambda (x)
    (* n x)))

(define double (multiplier 2))  ; Public
(define triple (multiplier 3))  ; Public

To expose the procedures as an R7RS library, I created a file mylib.sld:

(define-library (mylib)
  (export double
          triple)
  (import (scheme base))
  (include "mylib.scm"))

How do I similarly export the procedures as an R6RS library? To avoid code repetition, both R6RS and R7RS libraries should share the same code.

0

There are 0 best solutions below