R7RS Scheme specification:
I have often used (slib format)
for formatting text, which is borrowed from
Lisp. This library provides a scheme-like way of formatting text. (Note:
the Tangerine Edition refers to SRFI 159, but that has been withdrawn in
favour of SRFI 166.)
R7RS Name
|
Documentation
|
Description
|
(scheme show)
|
(srfi 159)
|
Formatting text
|
I have used Dorai Sitaram's pregexp library
in the past, which uses a familiar string-based representation of
regular-expressions. This library, like show
, provides a scheme-like way of
describing regular expressions.
R7RS Name
|
Documentation
|
Description
|
(scheme regex)
|
(srfi 115)
|
Regular expressions
|
- Text
- This library introduces an immutable form of a string, called a
text
.
The rationale for this library is that more efficient operations can be
implemented for strings which are immutable, particularly if they are
unicode-encoded. Helpfully, many of the implemented operations work on
"textual" objects, which includes both the new immutable text
data type and
regular string
values.
R7RS Name
|
Documentation
|
Description
|
(scheme text)
|
(srfi 135)
|
Immutable strings
|
- Numbers
- These libraries provide additional functionality and potentially efficient implementations for working with numbers.
R7RS Name
|
Documentation
|
Description
|
(scheme division)
|
(srfi 141)
|
Provides six different ways of computing the quotient and remainder (q and r ) when dividing an integer n so that n = dq+r
|
(scheme bitwise)
|
(srfi 151)
|
Treats integers as twos-complement numbers, and provides a complete set of operators for manipulating integers in bitwise form
|
(scheme fixnum)
|
(srfi 143)
|
Provides efficient implementations of operations on integers which are "small enough" to be treated within a single machine word
|
(scheme flonum)
|
(srfi 144)
|
Provides efficient implementations of operations on flonums, a subset of the full range of inexact real numbers
|
Data structures (collections) seem to have been a major focus of R7RS-large
development. The small language has built-in the list and vector datatypes, a
specialisation of vector to bytevectors, and a simple mapping pattern in the
form of association lists.
- Set-like
- Designed to hold one or more values without any additional structure, such as order, imposed on them. Set-like structures may enforce unique values (sets) or permit multiple values (bags, or multi-sets).
R7RS Name
|
Documentation
|
Description
|
(scheme box)
|
(srfi 111)
|
Provides a single-item container
|
(scheme set)
|
(srfi 113)
|
Provides both set and bag data structures, along with a wide-range of supporting functions
|
(scheme charset)
|
(srfi 14)
|
Deals specifically with sets of characters, making available some predefined character sets, and operations to work with such sets
|
- List-like
- Designed to hold one or more values in a specific order. Values can be duplicated within the data structure.
R7RS Name
|
Documentation
|
Description
|
(scheme list)
|
(srfi 1)
|
Provides a wide-range of functions working with the built-in list datatype
|
(scheme ilist)
|
(srfi 116)
|
Provides an immutable version of the built-in list along with functions equivalent to those in the list library, where appropriate
|
(scheme rlist)
|
(srfi 101)
|
An alternative to the built-in list , but offers more efficient references (rlist-ref is O(log n)) and a functional interface. Note that, unlike the SRFI and implementation in Gauche, the R7RS-large version prefixes identifiers with "r" to avoid name-clashes with list
|
(scheme ideque)
|
(srfi 134)
|
Provides an immutable deque data struture, a double-ended queue which supports efficient (O(1)) adding/removal of items from either end
|
(scheme list-queue)
|
(srfi 117)
|
A mutable deque data structure, which offers efficient adding/removal of items from the front and adding of items to the back
|
Vectors are a variant of lists, which both hold values in a specific order, but
also provide O(1) look-up time using a numeric index. The different types allow
for specialisation in terms of the particular contents.
R7RS Name
|
Documentation
|
Description
|
(scheme vector)
|
(srfi 133)
|
Provides a wide-range of functions working with the built-in vector datatype
|
(scheme bytevector)
|
(rnrs bytevectors)
|
Taken from R6RS
|
(scheme vector @)
|
(srfi 160)
|
Provide homogeneous equivalents to the vector type and library for specific numeric types; these can potentially be implemented more efficiently than the general form
|
- Map-like
- Collections of key-value pairs, where a key is used to retrieve a value stored within the collection. They can be thought of as a generalisation of the vector, except that any type of value can be used as the index, not just a number.
R7RS Name
|
Documentation
|
Description
|
(scheme hash-table)
|
(srfi 125)
|
Provides a standard hash table data structure
|
(scheme mapping)
|
(srfi 146)
|
Provides a more general data structure than hash-table , supporting functional procedures
|
- Stream-like
- These data structures do not store existing values, but instead construct new values on demand.
R7RS Name
|
Documentation
|
Description
|
(scheme generator)
|
(srfi 158)
|
Provides both "generators" and "accumulators". A generator is a zero-argument procedure that acts as a source of values; an accumulator is a single-argument procedure that acts as a sink of values
|
(scheme lseq)
|
(srfi 127)
|
A list where the "cdr" element is a generator; this is similar to stream except that the lists are odd, so the first element is eager evaluated
|
(scheme stream)
|
(srfi 41)
|
Provides low-level and higher-level support for lazy lists; lists where each item is constructed on demand. These lists are even, so both elements are lazy evaluated
|
These libraries are used to support data structures.
R7RS Name
|
Documentation
|
Description
|
(scheme comparator)
|
(srfi 128)
|
Bundles together the equality, comparison and hash functions for different data-types, so they can be used in the construction of a data structure for a specific type of data. This library is used in: hash-table , mapping , and set
|
(scheme ephemeron)
|
(srfi 124)
|
Can be used to implement data structures with weak references, which permit garbage collection
|
(scheme sort)
|
(srfi 132)
|
A collection of sort, merge and related functions, working on the built-in list and vector datatypes
|
This edition appears to have been
voted on, but there are not many details available yet, e.g. what the `(scheme
NAME)` names will be. Here is a list of what might be expected:
R6RS includes several libraries, which I've tabulated below for easy reference.
R7RS-large has gradually included a number of approximately equivalent
libraries, so I've listed these to make it easy to link the two standards -
"equivalent" is meant loosely, as there are many variations and even
incompatibilities.
R6RS Name
|
Description
|
R7RS Equivalent
|
(rnrs unicode)
|
Unicode semantics when working with characters and strings.
|
Mostly covered in (scheme base) and (scheme char) , although full Unicode support is optional
|
(rnrs bytevectors)
|
Deals with blocks of binary data.
|
(scheme bytevector) included in R7RS-large (Tangerine)
|
(rnrs lists)
|
Useful procedures that operate on lists.
|
Anything not in (scheme base) is in (scheme list) , included in R7RS-large (Red)
|
(rnrs sorting)
|
Provides list-sort and vector-sort .
|
(scheme sort) included in R7RS-large (Red)
|
(rnrs control)
|
Useful control structures (e.g. when , do ).
|
Included in (scheme base)
|
(rnrs records *)
|
Record data-types.
|
An alternative form of record is included in (scheme base)
|
(rnrs exceptions)
|
Exception handling and exception-raising constructs.
|
Included in (scheme base)
|
(rnrs conditions)
|
For creating and inspecting condition types and values.
|
-
|
(rnrs io *)
|
For performing input and output.
|
Some support in (scheme base) and (scheme file)
|
(rnrs files)
|
Provides file-exists? and delete-file .
|
Included in (scheme file)
|
(rnrs programs)
|
Provides command-line and exit .
|
Included in (scheme process-context)
|
(rnrs arithmetic fixnums)
|
Various operations on fixnums.
|
(scheme fixnum) included in R7RS-large (Tangerine)
|
(rnrs arithmetic flonums)
|
Various operations on flonums.
|
(scheme flonum) included in R7RS-large (Tangerine)
|
(rnrs arithmetic bitwise)
|
Generic operations on exact integer objects.
|
(scheme bitwise) included in R7RS-large (Tangerine)
|
(rnrs syntax-case)
|
Support for writing low-level macros in a high-level style.
|
Included in R7RS-large (Yellow)
|
(rnrs hashtables)
|
Operations for creating and using hashtables.
|
(scheme hash-table) included in R7RS-large (Red)
|
(rnrs enums)
|
Enumerated values and enumerated sets.
|
- Although (srfi 209) is scheduled for vote in R7RS-large (Orange).
|
Considering the levels of R7RS-large support in the implementations I use:
- Gauche
- complete support.
- Kawa
- partial support with r7rs-libs. Kawa's implementation of continuations - see internals/complications - means
(scheme generator)
and (scheme lseq)
cannot be supported.
- Sagittarius
- complete support.
- Gauche
- complete support.
- Kawa
- partial support with r7rs-libs. Missing are
(scheme show)
(scheme regex)
(scheme fixnum)
(scheme flonum)
(scheme bytevector)
(scheme vector @)
(scheme mapping)
- Sagittarius
- complete support, except that
(scheme show)
is named (scheme format)
.
Library Name
|
Description
|
Gauche
|
Kawa
|
Sagittarius
|
syntax-case
|
From R6RS
|
-
|
-
|
Y
|
identifier-case
|
From R6RS
|
-
|
-
|
Y
|
(srfi 139)
|
Syntax parameters
|
-
|
-
|
Y
|
(srfi 188)
|
Splicing binding constructs for syntactic keywords
|
-
|
-
|
-
|
(srfi 212)
|
Aliases
|
-
|
see define-alias
|
-
|
(srfi 213
|
Identifier properties
|
-
|
-
|
-
|
(srfi 61)
|
A more general cond clause
|
built-in
|
-
|
Y
|
(srfi 8)
|
receive : Binding to multiple values
|
Y
|
Y
|
Y
|
(srfi 31)
|
A special form rec for recursive evaluation
|
Y
|
r7rs-libs
|
Y
|
(srfi 26)
|
Notation for specializing parameters without currying
|
Y
|
Y
|
Y
|
(srfi 219)
|
Define higher-order lambda
|
Y
|
-
|
built-in
|
(srfi 210)
|
Procedures and syntax for multiple values
|
r7rs-libs
|
r7rs-libs
|
r7rs-libs
|