Arne wrote:

Indeed, Scheme doesn't have a clear separation between full-featured
RnRS implementations and subset implementation. Several people have
noted that this is confusing.

Maybe the r7rs-benchmark preludes and postludes could be a start for
documentation of that?
https://github.com/ecraven/r7rs-benchmarks/tree/master/src

Example: Guile3-prelude.scm:
https://github.com/ecraven/r7rs-benchmarks/blob/master/src/Guile3-prelude.scm

     (use-modules (ice-9 rdelim))
     (define-syntax import
       (syntax-rules ()
         ((import stuff ...)
          (begin) ;; do nothing
          )))
     (define flush-output-port force-output)
     (define current-second current-time)
     (define (jiffies-per-second) internal-time-units-per-second)
     (define current-jiffy get-internal-real-time)
     (define exact inexact->exact)
     (define inexact exact->inexact)
     (define (square x) (* x x))
     (define (write-string str out) (display str out)) ; sufficient for tail.scm
     (define (this-scheme-implementation-name) (string-append "guile3-" 
(version)))
     (read-enable 'r7rs-symbols)
     (print-enable 'r7rs-symbols)
     (use-modules (rnrs bytevectors)
             (rnrs base)
             (srfi srfi-9))

Those might be a good start for filling in the gaps in RnRS support.

Some Scheme implemenetations have existing RnRS test suites. IIRC those are mostly cloned and hacked from Clinger's tests for Larceny. A test suite has the advantage that it is executable documentation of RnRS compatibility. Manual documentation is prone to mistakes.

Could some of those be eligible to be merged into (guile-user) — the
interactive module of the REPL?

I'm not qualified to answer that one.

Is (import (srfi :N)) portable in practice?

AFAIK:

(import (srfi :N)) is portable across all R6RS implementations.

(import (srfi N)) - without the colon - is portable across all R7RS
implementations.

[...]

Thank you for the overview!

Do you want to cross-post this part of your answer to the srfi-list?

You're welcome. I think I have posted an equivalent overview to srfi-discuss in the past, but I can't find it.

R7RS has an (include "...") mechanism which R6RS lacks. chez-srfi adds
a similar mechanism on top of the R6RS library system. The chez-srfi
mechanism is widely portable in practice.

Does that work the same as Guile’s (include "...")?

 From the reference manual:

      -- Scheme Syntax: include file-name
          Open FILE-NAME, at expansion-time, and read the Scheme forms that
          it contains, splicing them into the location of the ‘include’,
          within a ‘begin’.
If FILE-NAME is a relative path, it is searched for relative to the
          path that contains the file that the ‘include’ form appears in.
[...]

Yes, Guile's include sounds very similar to R7RS include. There may be obscure technical differences, but the intent is exactly the same.

Reply via email to