R6RS Support
============

See R6RS Libraries, for more information on how to define R6RS libraries, and their integration with Guile modules.

Incompatibilities with the R6RS
-------------------------------

There are some incompatibilities between Guile and the R6RS. Some of them are intentional, some of them are bugs, and some are simply unimplemented features. Please let the Guile developers know if you find one that is not on this list.

  * In the R6RS, internal definitions expand to letrec*, not letrec. Guile does not support letrec*, though that would be nice.

  * The R6RS specifies many situations in which a conforming implementation must signal a specific error. Guile doesn't really care about that too much -- if a correct R6RS program would not hit that error, we don't bother checking for it.

  * Multiple library forms in one file are not yet supported. This is because the expansion of library sets the current module, but does not restore it. This is a bug.

R6RS Standard Libraries
-----------------------

The R6RS standard defines a core language and a number of standard libraries. Here we briefly list the libraries that have been implemented for Guile.

All of these libraries are available as Guile modules, for use in standard Guile code, via use-modules, or for use in portable R6RS code, via the library and import forms. See R6RS Libraries, for more information.

We do not attempt to document these libraries fully here, as most of their functionality is already available in Guile itself. The expectation is that most Guile users will use the well-known and well-documented Guile modules. These R6RS libraries are mostly useful to users who want to port their code to other R6RS systems, in which case a copy of the R6RS report itself is necessary. It may be found at the R6RS web page, http://r6rs.org/.

First, there is the base library, defined in the base R6RS report:

     (use-modules (rnrs base))

One may also import it to the current module using the R6RS import form:

     (import (rnrs base))

All of the rnrs modules have the version of (6), which may be specified when importing the module:

     (import (rnrs base (6)))
     (use-modules ((rnrs base) #:version (6)))

See R6RS Version References, for more information on versions.

Next there is a set of libraries that collectively form the (rnrs) composite library. The following statements are equivalent:

     (import (rnrs))

     (use-modules (rnrs))

     (import (rnrs arithmetic bitwise (6))
             (rnrs arithmetic fixnums (6))
             (rnrs arithmetic flonums (6))
             (rnrs base (6))
             (rnrs bytevectors)
             (rnrs conditions (6))
             (rnrs control (6))
             (rnrs enums (6))
             (rnrs exceptions (6))
             (rnrs files (6))
             (rnrs hashtables (6))
             (rnrs io ports)
             (rnrs io simple (6))
             (rnrs lists (6))
             (rnrs programs (6))
             (rnrs records inspection (6))
             (rnrs records procedural (6))
             (rnrs records syntactic (6))
             (rnrs sorting (6))
             (rnrs syntax-case (6)))

Finally there are a number of modules that the (rnrs) module does not re-export:

     (import (rnrs mutable-pairs (6))
             (rnrs mutable-strings (6))
             (rnrs r5rs (6))
             (rnrs eval (6))
             (rnrs unicode (6)))

See the R6RS Standard Libraries specification, for more information on these modules.