0

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.

Flux
  • 9,805
  • 5
  • 46
  • 92
  • Which Scheme implementation are you using? `include` seems like the right idea. What have you tried that isn't working? – Peter Winton Jul 06 '22 at 11:04
  • ["...If you write a library for one standard, it is not importable in implementations that have only the other standard ... They just use a different surface syntax for the library definition language"](https://groups.google.com/g/scheme-reports-wg2/c/YxVutAvKdaw/m/9JpMQ-A6BQAJ) – mnemenaut Jul 06 '22 at 13:46
  • @PeterWinton I am not using any particular Scheme implementation. `include` is not in R6RS. – Flux Jul 06 '22 at 15:24

0 Answers0