SRFI Support
~~~~~~~~~~~~

SRFIs (Scheme Requests For Implementations) describe and implement
additional Scheme libraries. The SRFI effort is open to anyone,
and is described at http://srfi.schemers.org[].

SRFIs are numbered.  Importing SRFIs into an R7RS library or
program is straightforward:

----------------------------------------------------------------
(import (srfi 19)
        (srfi 27))
----------------------------------------------------------------

The R6RS forbids numbers within library names, so R6RS libraries
and programs must import SRFI libraries using the SRFI 97 naming
convention in which a colon precedes the number:

----------------------------------------------------------------
(import (srfi :19)
        (srfi :27))
----------------------------------------------------------------

[WARNING]
================================================================
R6RS's prohibition on library names that contain integers was
always pretty silly, fully deserving of a silly workaround such
as SRFI 97.

Larceny has given up on giving R6RS-compatible SRFI 97 names to
SRFI libraries. When Larceny supports a new SRFI library, its
name will not contain colons.
================================================================

To test whether particular SRFIs are available, use the R7RS
`cond-expand` feature:

----------------------------------------------------------------
(cond-expand
 ((and (library (srfi 19))
       (library (srfi 27)))
  (import (srfi 19))
  (import (srfi 27)))
 (else ...))
----------------------------------------------------------------

[NOTE]
================================================================
`cond-expand` is a feature of the R7RS standard, and cannot be
used by R6RS libraries or programs.
================================================================

[TIP]
================================================================
Calling the R7RS `features` procedure with no arguments will
return a list of all features that would be recognized by
`cond-expand` in that session of Larceny.
================================================================

==== Using SRFIs in R5RS mode

R5RS programs can use `cond-expand` as implemented by SRFI 0,
"Feature-based conditional expansion construct".  (SRFI 0 must
be loaded into Larceny before it can be used; see below.)
Larceny provides the following nonstandard key for use in SRFI 0:
    
----------------------------------------------------------------
    larceny
----------------------------------------------------------------

Some SRFIs are built into Larceny's R5RS mode, but most must be
loaded dynamically using Larceny's `require` procedure:

----------------------------------------------------------------
    > (require 'srfi-0)
----------------------------------------------------------------

In R5RS mode, Larceny does not support SRFIs numbered 99 and higher.

The design documents for SRFI 0 and other SRFIs are available at
http://srfi.schemers.org[].
