Scheme Requests for Implementation
Scheme Requests for Implementation
SRFIs extend the Scheme programming language. You can help. Start by
joining the discussion
on one of our mailing lists.
Arvydas Silanskas's
index.scheme.org
is an increasingly comprehensive index of Scheme implementations, standards, and SRFIs.
Shiro Kawai's
Practical Scheme
includes a
cross-reference
showing which Scheme implementations support which SRFIs. It's a wiki page, so please help keep it up to date.
The SRFIs
Search for
Filter by
Show
abstracts
Sort by
269
Portable Test Definitions
, by Andrew Tropin and Ramin Honary
Draft:
2026-04-02
Keywords:
Testing
See also
SRFI 64: A Scheme API for test suites
This SRFI defines a portable API for test definitions that is
decoupled from test execution and reporting. It provides three
primitives: the universal
is
macro for
assertions,
test
for grouping assertions into
independently executable units, and
suite
for organizing
tests into hierarchies. Tests and suites can carry user-provided
metadata to adjust the behavior of a test runner, for example, to
select tests by tags or to enforce timeout values. The API is tiny,
yet capable and flexible. By focusing on the definition and leaving
execution semantics to test runners, this SRFI offers a common ground
that can reduce fragmentation among testing libraries.
Unlike side-effect-driven testing frameworks (e.g. SRFI-64),
this API produces first-class runtime entities, making it easy to
filter, schedule, wrap them in exception guards and continuation
barriers, run in arbitrary order, and re-run dynamically generated
test subsets. In addition to the usual CLI test runners, it enables
runtime-friendly test runners that integrate well with highly
interactive development workflows inside REPLs and IDEs, significantly
increasing control over test execution and shortening the feedback
loop.
To bridge the test definitions and test runners, the SRFI specifies
a message-passing programming interface, and test loading and
execution semantics recommendations for test runner implementers.
268
Multidimensional Array Literals
, by Per Bothner (SRFI 163), Peter McGoron (design), John Cowan (editor and steward), and Wolfgang Corcoran-Mathe (implementation)
Draft:
2026-03-30
Keywords:
Reader Syntax
See also
SRFI 25: Multi-dimensional Array Primitives
SRFI 122: Nonempty Intervals and Generalized Arrays
, and
SRFI 231: Intervals and Generalized Arrays
This is a specification of a lexical syntax for multi-dimensional arrays. Textually it is an alteration of
SRFI 163
, which is an extension of the
Common Lisp array reader syntax
to handle non-zero lower bounds and optional uniform element types (compatibly with
SRFI 4
and
SRFI 160
). It can be used in conjunction with
SRFI 25
SRFI 122
, or
SRFI 231
. There are recommendations for output formatting,
read-array
and
write-array
procedures, and a suggested
format-array
procedure.
267
Raw String Syntax
, by Peter McGoron
Draft:
2026-01-17
Keywords:
Reader Syntax
Raw strings are a lexical syntax for strings that do not interpret escapes inside of them and are useful in cases where the string data has a lot of characters such as
or
that would otherwise have to be escaped. This SRFI proposes a raw string syntax that allows for a customized delimiter to enclose the character data. Importantly, for any string, there exists a delimiter such that the raw string using that delimiter can represent the string verbatim. The raw strings in this SRFI do not do any special whitespace handling.
266
The expr syntax
, by José Bollo
Draft:
2026-01-16
Keywords:
Syntax
See also
SRFI 105: Curly-infix-expressions
The syntax
expr
allows one to write arithmetic expressions using a syntax near to mathematical notation, potentially improving the readability of Scheme programs.
265
The CFG Language
, by Marc Nieper-Wißkirchen
Draft:
2025-10-30
Keywords:
Control Flow
Library name: cfg
See also
SRFI 42: Eager Comprehensions
and
SRFI 242: The CFG Language
This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.
The language described in this SRFI is not meant to be directly used in programs but by library authors to build abstractions like loop facilities on top of it.
264
String Syntax for Scheme Regular Expressions
, by Sergei Egorov
Final:
2025-10-11
Keywords:
Data Structure
Text
See also
SRFI 115: Scheme Regular Expressions
This SRFI proposes SSRE, an alternative string-based syntax for Scheme Regular Expressions as defined by
SRFI 115
. String syntax is both compact and familiar to many regexp users; it is translated directly into SRE S-expressions, providing equivalent constructs. While the proposed syntax mostly follows PCRE, it takes into account specifics of Scheme string syntax and limitations of SRE, leaving out constructs that either duplicate functionality provided by Scheme strings or have no SRE equivalents. The repertoire of named sets and boundary conditions can be extended via a parameter mechanism. Extensions to PCRE syntax allow concise expression of operations on named character sets.
263
Prototype Object System
, by Daniel Ziltener
Draft:
2025-06-09
Keywords:
Object-Oriented Programming
See also
SRFI 20: Simple object system
This SRFI proposes a "Self"-inspired prototype object system. Such an object system works by having prototype objects that are derived repeatedly to modify, extend, and use them, and is interacted with by passing messages.
262
Extensible pattern matcher
, by Daphne Preston-Kendal
Draft:
2025-05-07
Keywords:
Pattern Matching
Library name: match
See also
SRFI 200: Pattern Matching
SRFI 204: Wright-Cartwright-Shinn Pattern Matcher
SRFI 241: Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data
, and
SRFI 257: Simple extendable pattern matcher with backtracking
A pattern matching form which can operate on arbitrary Scheme values is defined. It conforms to the following design principles.
The syntax of patterns is declarative. The syntax is extensible in the same way that Scheme’s procedural syntax is extensible by macros.
For most use cases, the use of the pattern matcher should produce code which is essentially as efficient at run time as equivalent procedural Scheme code would be, assuming a moderately optimizing Scheme implementation. This applies only when the equivalent code is also equivalently correct in terms of handling of error cases (i.e. including all type checks done automatically by the pattern matcher). However, using extension syntax should not cause this principle to be violated (provided the extension syntax is appropriately implemented).
261
Portable SRFI Library Reference
, by WANG Zheng
Final:
2025-11-07
Keywords:
Modules
See also
SRFI 97: SRFI Libraries
This SRFI proposal addresses systemic compatibility issues exposed by the
SRFI 97
-defined library reference format
(srfi :
and advocates for two more modernized, portable and readable alternatives:
(srfi srfi-
and
(srfi
260
Generated Symbols
, by Marc Nieper-Wißkirchen
Final:
2025-05-07
Keywords:
Data Structure
See also
SRFI 258: Uninterned symbols
This SRFI defines the procedure
generate-symbol
. Each time it is invoked, the procedure returns a new symbol whose name cannot be guessed. The returned symbol is a standard symbol for all purposes; it obeys write/read invariance and it is equal to another symbol if and only if their names are spelled the same.
259
Tagged procedures with type safety
, by Daphne Preston-Kendal
Final:
2025-05-07
Keywords:
Data Structure
Library name: tagged-procedures
See also
SRFI 229: Tagged Procedures
Tagged procedures are procedures with boxes attached, which can be used to create applicable records and other abstractions. This SRFI proposes a variant with the notion of a tagging protocol, analogous to a record type definition, for ensuring encapsulation and security for tagged procedures.
258
Uninterned symbols
, by Wolfgang Corcoran-Mathe
Final:
2025-03-26
Keywords:
Data Structure
See also
SRFI 260: Generated Symbols
An uninterned symbol is not the same as any other symbol, even one with the same name. These symbols are useful in macro programming and in other situations where guaranteed-unique names are needed. A survey of uninterned and uniquely named symbols in Scheme is also provided.
257
Simple extendable pattern matcher with backtracking
, by Sergei Egorov
Final:
2025-12-22
Keywords:
Pattern Matching
See also
SRFI 200: Pattern Matching
SRFI 204: Wright-Cartwright-Shinn Pattern Matcher
SRFI 241: Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data
, and
SRFI 262: Extensible pattern matcher
Pattern matching extends Scheme's repertoire of conditional constructs, allowing decomposition of compound data structures and binding their parts to variables. This SRFI proposes one such construct,
match
, which offers all the core functionality specified in
SRFI 200
, while extending it with support for non-linear patterns and backtracking. The proposed construct is modular and supports easy extension through the
define-match-pattern
mechanism. It can be implemented portably in R⁷RS-Small.
256
Minimal extension to SRFI 9/R7RS small record type definitions for inheritance
, by Daphne Preston-Kendal
Withdrawn:
2025-02-08
Keywords:
Data Structure
Record Type
See also
SRFI 9: Defining Record Types
SRFI 99: ERR5RS Records
, and
SRFI 237: R6RS Records (refined)
A SRFI 9-style
define-record-type
is specified which allows subtyping while preserving encapsulation, in that the field structure of supertypes remains an implementation detail with which subtypes need not concern themselves.
255
Restarting conditions
, by Wolfgang Corcoran-Mathe
Final:
2024-12-22
Keywords:
Exceptions
See also
SRFI 249: Restarting conditions
When an exceptional situation is encountered by a program, it usually creates a condition object describing the situation, and then passes control to an exception handler. The signaler and handler are two different parts of a system, between which there is a barrier of abstraction. In order to recover gracefully and flexibly from exceptional situations, however, the signaler can provide multiple ways by which the handler can restart the computation, some of which may require extra input. Often, the choice of method of recovery is left up to a human user, who may be prompted for the input needed to recover. This SRFI proposes a mechanism called
restarters
, which uses a new type of condition object and an associated exception handler to encapsulate the information necessary to restart a computation. We also describe the behavior and interface of
interactor
procedures, which implement interactive restarts.
254
Ephemerons and Guardians
, by Marc Nieper-Wißkirchen
Draft:
2024-09-11
Keywords:
Garbage Collection
See also
SRFI 124: Ephemerons
and
SRFI 246: Guardians
This SRFI describes three concepts associated with the storage management of a Scheme system,
ephemerons
guardians
, and
transport cell guardians
An ephemeron is a record structure with a
key
and a
value
field. An ephemeron can be
broken
. Breaking an ephemeron replaces the key and value with
#f
. An implementation of this SRFI breaks an ephemeron when it proves that the storage occupied by the key could be reclaimed if the ephemeron were broken.
A guardian is a structure containing objects as
guarded
or
resurrected
elements. Initially, guardians are empty. Objects can be added in guarded elements to the guardian by the programmer. An implementation of this SRFI resurrects an element when it proves that the storage occupied by the object could be reclaimed if all guardians in the system were empty. Objects from resurrected elements can be queried and removed from the guardian by the programmer. Instead of the object itself, a
representative
can be returned.
A transport cell guardian is a structure containing
transport cells
, similar to a guardian. Whenever an object in a guarded transport cell in the transport cell guardian is moved by the garbage collector, the transport cell is resurrected so that it can be queried by the programmer.
253
Data (Type-)Checking
, by Artyom Bologov
Final:
2024-11-15
Keywords:
Record Type
Type Checking
See also
SRFI 143: Fixnums
SRFI 144: Flonums
SRFI 145: Assumptions
, and
SRFI 187: ALAMBDA and ADEFINE
Data validation and type checking (supposedly) make for more correct code. And faster code too, sometimes. And, in rare cases, code that's easier to follow than un-checked code. Unfortunately, Scheme does not have many (type-)checking primitives out of the box. This SRFI provides some, with the aim of allowing more performant and correct code with minimum effort on the user side. Both (manual) argument checking/validation (
check-arg
) and return value(s) (
values-checked
) checking/coercion are provided. Syntax sugar like
define-checked
and
define-record-type-checked
is added on top.
252
Property Testing
, by Antero Mejr
Final:
2024-04-25
Keywords:
Testing
See also
SRFI 64: A Scheme API for test suites
SRFI 158: Generators and Accumulators
, and
SRFI 194: Random data generators
This defines an extension of the
SRFI 64
test suite API to support property testing. It uses
SRFI 158
generators to generate test inputs, which allows for the creation of custom input generators. It uses
SRFI 194
as the source of random data, so that the generation of random test inputs can be made deterministic. For convenience, it also provides procedures to create test input generators for the types specified in R7RS-small. The interface to run property tests is similar to that of
SRFI 64
, and a property-testing-specific test runner is specified in order to display the results of the propertized tests.
251
Mixing groups of definitions with expressions within bodies
, by Sergei Egorov
Final:
2024-05-06
Keywords:
Binding
See also
SRFI 245: Mixing definitions and expressions within bodies
Scheme has traditionally required procedure bodies and the bodies of derived constructs
such as
let
to contain definitions followed by commands/expressions.
This SRFI proposes to allow mixing commands and groups of definitions in such bodies, so that each
command/expression is in the scope of all local definition groups preceding it, but not in scope of
the local definition groups following it. This approach is backwards compatible with R7RS and
upholds the intuitive rule that to find the definition of a lexical variable, one has
to look
up
the source code tree.
250
Insertion-ordered hash tables
, by John Cowan and Daphne Preston-Kendal
Final:
2025-10-27
Keywords:
Data Structure
See also
SRFI 69: Basic hash tables
SRFI 125: Intermediate hash tables
SRFI 126: R6RS-based hashtables
, and
SRFI 128: Comparators (reduced)
This SRFI defines an interface to hash tables, which are widely recognized as a fundamental data structure for a wide variety of applications. A hash table is a data structure that:
Is disjoint from all other types.
Provides a mapping from objects known as
keys
to corresponding objects known as
values
Keys may be any Scheme objects in some kinds of hash tables, but are restricted in other kinds.
Values may be any Scheme objects.
Provides an
equality predicate
which defines when a proposed key is the same as an existing key. No table may contain more than one value for a given key.
Provides a
hash function
which maps a candidate key into a non-negative exact integer.
Supports mutation as the primary means of setting the contents of a table.
Provides key lookup and destructive update in (expected) amortized constant time, provided that a satisfactory hash function is available.
Does not guarantee that whole-table operations work in the presence of concurrent mutation of the whole hash table. (Values may be safely mutated.)
Unlike the hash tables of
SRFI 125
, which is the direct ancestor of this specification, the hash tables described here are ordered by insertion: that is, associations inserted earlier in the history of the hash table appear earlier in the ordering. Advances in the implementations of hash tables, as provided by C++, Python, JavaScript, etc., make the provision of this new facility practical. As a result, the hash tables of this SRFI do not necessarily interoperate with the hash tables of SRFI 125,
SRFI 126
, or existing R6RS implementations.
249
Restarting conditions
, by John Cowan
Withdrawn:
2024-09-13
Keywords:
Exceptions
See also
SRFI 255: Restarting conditions
When an exceptional situation is encountered by a program, it may create a
condition
object describing the situation and then signal the condition and pass control to a condition handler. The signaler and handler are two different parts of a system, between which there is a barrier of abstraction. In order to recover gracefully and flexibly from exceptional situations, however, the signaler can provide multiple ways by which the handler can restart the computation, some of which may require extra input. Often, the decision of which method of recovery to choose is left up to a human user, who may be prompted for the input needed to recover. This SRFI proposes a simple mechanism called
restarters
to encapsulate the information necessary to restart a computation with associated interactive prompters.
248
Minimal delimited continuations
, by Marc Nieper-Wißkirchen
Final:
2025-01-24
Keywords:
Continuations
See also
SRFI 226: Control Features
Scheme's exception system is extended so that exception handlers gain access to the delimited continuation representing the rest of the computation of the call of the thunk guarded by the handler. Algebraic effect handlers can be directly expressed in this extended exception system. The system directly implements the
shift0
reset0
delimited control operators. It is well known that other delimited control operators like
prompt0
control0
or
reset
shift
are expressible in
shift0
reset0
(and vice versa).
247
Syntactic Monads
, by Marc Nieper-Wißkirchen
Final:
2023-12-24
Keywords:
Syntax
This SRFI extends Scheme with a simple mechanism to implicitly add formal arguments to procedure definitions and to implicitly add arguments to procedure calls. Contrary to parameters (also known as fluids or dynamically bound variables), which can be used for the same purpose, no runtime overhead is generated.
246
Guardians
, by John Cowan
Withdrawn:
2024-09-11
Keywords:
Garbage Collection
Superseded
See also
SRFI 254: Ephemerons and Guardians
Guardians allow programs to protect objects from deallocation by the garbage collector and to determine which objects would otherwise have been deallocated. When the object has associated non-memory resources, a program can register it with a guardian. The GC will mark inaccessible objects but will not collect them; at the program's convenience, inaccessible objects are removed from the guardian and their non-memory resources are disposed of. Guardians allow objects to be saved from deallocation indefinitely so that they can be reused or so that clean-up or other actions can be performed using the data stored within the objects. Guardians avoid the problems associated with classical finalizers detailed in the Rationale section.
245
Mixing definitions and expressions within bodies
, by Daphne Preston-Kendal
Withdrawn:
2024-04-04
Keywords:
Binding
See also
SRFI 251: Mixing groups of definitions with expressions within bodies
Scheme has traditionally required procedure bodies and the bodies of derived constructs such as
let
to contain definitions followed by expressions. This SRFI proposes to allow expressions to appear before and intermingled with definitions in such bodies, as was allowed in program bodies by the R6RS and in library bodies by R7RS small.
244
Multiple-value Definitions
, by Marc Nieper-Wißkirchen
Final:
2023-02-05
Keywords:
Binding
Multiple-Value Returns
Library name: define-values
define-values
form is a definition that binds multiple variables from a single expression returning multiple values.
243
Unreadable Data
, by Lassi Kortela
Withdrawn:
2023-11-30
Keywords:
Reader Syntax
This SRFI suggests how the Scheme reader and writer should handle unreadable data in general, and unreadable objects in particular.
242
The CFG Language
, by Marc Nieper-Wißkirchen
Final:
2023-10-29
Keywords:
Control Flow
Library name: cfg
See also
SRFI 42: Eager Comprehensions
and
SRFI 265: The CFG Language
This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.
241
Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data
, by Marc Nieper-Wißkirchen
Final:
2023-03-23
Keywords:
Pattern Matching
Syntax
Library name: match
See also
SRFI 200: Pattern Matching
SRFI 204: Wright-Cartwright-Shinn Pattern Matcher
SRFI 257: Simple extendable pattern matcher with backtracking
, and
SRFI 262: Extensible pattern matcher
This SRFI describes a simple pattern matcher based on one originally devised by Kent Dybvig, Dan Friedman, and Eric Hilsdale, which has a catamorphism feature to perform recursion automatically.
240
Reconciled Records
, by Marc Nieper-Wißkirchen
Final:
2023-05-02
Keywords:
Data Structure
Record Type
See also
SRFI 9: Defining Record Types
SRFI 57: Records
SRFI 76: R6RS Records
SRFI 99: ERR5RS Records
SRFI 131: ERR5RS Record Syntax (reduced)
SRFI 136: Extensible record types
SRFI 150: Hygienic ERR5RS Record Syntax (reduced)
, and
SRFI 237: R6RS Records (refined)
This SRFI defines a version of the
define-record-type
definition of
RS
and
SRFI 237
that extends the
define-record-type
syntax of
RS
, reconciling both systems.
This SRFI is meant to be adopted by R
RS-large to integrate essentially the R
RS record system compatibly with the existing R
RS-small record system.
239
Destructuring Lists
, by Marc Nieper-Wißkirchen
Final:
2023-01-23
Keywords:
Syntax
Library name: list-case
This SRFI provides the
list-case
, the syntactic fundamental list destructor.
238
Codesets
, by Lassi Kortela
Final:
2023-01-16
Keywords:
Operating System
Error Handling
Introspection
Library name: codesets
See also
SRFI 170: POSIX API
SRFI 198: Foreign Interface Status
, and
SRFI 199: POSIX errno manipulation
Many programming interfaces rely on a set of condition codes where each code has a numeric ID, a mnemonic symbol, and a human-readable message. This SRFI defines a facility to translate between numbers and symbols in a codeset and to fetch messages by code. Examples are given using the Unix
errno
and
signal
codesets.
237
R6RS Records (refined)
, by Marc Nieper-Wißkirchen
Final:
2023-05-02
Keywords:
Data Structure
Record Type
See also
SRFI 9: Defining Record Types
SRFI 57: Records
SRFI 76: R6RS Records
SRFI 99: ERR5RS Records
SRFI 131: ERR5RS Record Syntax (reduced)
SRFI 136: Extensible record types
SRFI 150: Hygienic ERR5RS Record Syntax (reduced)
SRFI 240: Reconciled Records
, and
SRFI 256: Minimal extension to SRFI 9/R7RS small record type definitions for inheritance
The record mechanism of R
RS is refined. In particular, the triad of record names, record-type descriptors and record constructor descriptors can be effectively ignored and replaced with the single notion of a record descriptor. We also remove the restriction that the syntactic layer can only define one constructor per record type defined.
236
Evaluating expressions in an unspecified order
, by Marc Nieper-Wißkirchen
Final:
2022-11-22
Keywords:
Control Flow
Syntax
Library name: independently
This SRFI defines the
independently
syntax, which can be
used to combine side effects into one expression without
specifying their relative order.
235
Combinators
, by John Cowan (spec) and Arvydas Silanskas (implementation)
Final:
2023-02-28
Keywords:
Miscellaneous
This SRFI contains various procedures that accept and return procedures, as well as a few others, drawn from
an earlier version of Chicken
. Common Lisp has a few of them too, and more come from
the Standard Prelude from
Programming Praxis
. Using these procedures helps to keep code terse and reduce the need for ad hoc lambdas.
234
Topological Sorting
, by John Cowan and Arne Babenhauserheide
Final:
2024-09-24
Keywords:
Algorithm
Topological sorting is an algorithm that takes a graph consisting of nodes and other nodes that depend on them, forming a partial order, and returns a list representing a total ordering of the graph. If the graph is cyclic, the topological sort will fail. The procedure
topological-sort
returns three values. If sorting succeeds, the first value contains the result and the second and third are
#false
. If sorting fails, the result is
#false
and the second and third value may provide additional information about the error.
233
INI files
, by John Cowan (spec) and Arvydas Silanskas (implementation)
Final:
2022-10-13
Keywords:
I/O
An INI file is a configuration file that consists of key-value
pairs for properties, and sections that group the properties. The
name of these configuration files comes from the filename extension
INI
, short for initialization.
The format has become an informal standard in many contexts of configuration.
This SRFI provides access to the contents of an INI file.
232
Flexible curried procedures
, by Wolfgang Corcoran-Mathe
Final:
2022-04-06
Keywords:
Syntax
See also
SRFI 26: Notation for Specializing Parameters without Currying
and
SRFI 219: Define higher-order lambda
Scheme lacks a flexible way to create and apply curried procedures. This SRFI describes
curried
, a variant of
lambda
that creates true curried procedures which also behave just like ordinary Scheme procedures. They can be applied to their arguments one by one, all at once, or anywhere in between, without any novel syntax.
curried
also supports nullary and variadic procedures, and procedures created with it have predictable behavior when applied to surplus arguments.
231
Intervals and Generalized Arrays
, by Bradley J. Lucier
Final:
2022-09-25
Keywords:
Data Structure
Numbers
See also
SRFI 122: Nonempty Intervals and Generalized Arrays
SRFI 164: Enhanced multi-dimensional Arrays
SRFI 179: Nonempty Intervals and Generalized Arrays (Updated)
, and
SRFI 268: Multidimensional Array Literals
This SRFI specifies an array mechanism for Scheme. Arrays as defined here are quite general; at their most basic, an array is simply a mapping, or function, from multi-indices of exact integers $i_0,\ldots,i_{d-1}$ to Scheme values. The set of multi-indices $i_0,\ldots,i_{d-1}$ that are valid for a given array form the
domain
of the array. In this SRFI, each array's domain consists of the cross product of intervals of exact integers $[l_0,u_0)\times[l_1,u_1)\times\cdots\times[l_{d-1},u_{d-1})$ of $\mathbb Z^d$, $d$-tuples of integers. Thus, we introduce a data type called $d$-
intervals
, or more briefly
intervals
, that encapsulates this notion. (We borrow this terminology from, e.g., Elias Zakon's
Basic Concepts of Mathematics
.) Specialized variants of arrays provide portable programs with efficient representations for common use cases.
This is a revised and improved version of
SRFI 179
230
Atomic Operations
, by Marc Nieper-Wißkirchen
Final:
2021-11-15
Keywords:
Concurrency
See also
SRFI 18: Multithreading support
and
SRFI 226: Control Features
This SRFI defines atomic operations for the Scheme programming language. An
atomic operation
is an operation that, even in the presence of multiple threads, is either executed completely or not at all. Atomic operations can be used to implement mutexes and other synchronization primitives, and they can be used to make concurrent algorithms lock-free. For this, this SRFI defines two data types,
atomic flags
and
atomic (fixnum) boxes
, whose contents can be queried and mutated atomically. Moreover, each atomic operation comes with a
memory order
that defines the level of synchronization with other threads.
229
Tagged Procedures
, by Marc Nieper-Wißkirchen
Final:
2021-11-15
Keywords:
Data Structure
See also
SRFI 259: Tagged procedures with type safety
This SRFI defines
tagged procedures
, which are procedures that are tagged with a Scheme value when created through the syntax
lambda/tag
and
case-lambda/tag
. The value of the tag of a procedure can be retrieved with
procedure-tag
, and the predicate
procedure/tag?
discerns whether a procedure is tagged.
228
Composing Comparators
, by Daphne Preston-Kendal
Final:
2022-12-10
Keywords:
Comparison
Library name: composing-comparators
See also
SRFI 128: Comparators (reduced)
and
SRFI 162: Comparators sublibrary
Further procedures for defining
SRFI 128
comparators.
Best enjoyed in combination with
SRFI 162
227
Optional Arguments
, by Marc Nieper-Wißkirchen (spec and R6RS implementation) and Daphne Preston-Kendal (R7RS implementation)
Final:
2021-11-16
Keywords:
Binding
See also
SRFI 89: Optional positional and named parameters
This SRFI specifies the
opt-lambda
syntax, which generalizes
lambda
. An
opt-lambda
expression evaluates to a procedure that takes a number of required and a number of optional (positional) arguments whose default values are determined by evaluating corresponding expressions when the procedure is called.
This SRFI also specifies a variation
opt*-lambda
, which is to
opt-lambda
as
let*
is to
let
and the related binding constructs
let-optionals
and
let-optionals*
Finally, for those who prefer less explicit procedure definitions, a sublibrary provides
define-optionals
and
define-optionals*
226
Control Features
, by Marc Nieper-Wißkirchen
Final:
2023-04-25
Keywords:
Continuations
Control Flow
See also
SRFI 18: Multithreading support
SRFI 34: Exception Handling for Programs
SRFI 39: Parameter objects
SRFI 45: Primitives for Expressing Iterative Lazy Algorithms
SRFI 97: SRFI Libraries
SRFI 154: First-class dynamic extents
SRFI 155: Promises
SRFI 157: Continuation marks
, and
SRFI 158: Generators and Accumulators
Whenever an expression is evaluated during the run of a Scheme program, there is a continuation awaiting the values of the expression. It is a distinguishing property of the Scheme programming language to offer a procedure (named
call/cc
) that captures the current continuation as a procedure, which, when called, aborts the then-current continuation and reinstates the captured one.
One can visualize a continuation as a list of (continuation) frames where a non-tail call adds a frame to the top of the list and where the return from a non-tail call removes the appropriate frame.
Moreover, each expression is evaluated in a dynamic environment that conceptually holds the values of parameters like the current output port and the dynamic-wind stack at the point of evaluation. As the dynamic environment is captured and reinstated along the continuation when the
call/cc
machinery is used, we can view it conceptually as part of the continuation.
The libraries defined in this SRFI are all concerned with continuations in a wider sense. More specifically, the topics are as follows:
Continuation Prompts
A continuation prompt is a special continuation frame that is tagged with a so-called prompt tag. Procedures to install continuation prompts and to abort the current continuation and escape back to a previously installed continuation prompt are provided. Moreover, continuation prompts are equipped with handlers that are invoked when a continuation is aborted to them.
Continuations
When continuations are captured, the list of captured continuation frames is always delimited by some continuation prompt. This extends the semantics of Scheme’s
call-with-current-continuation
. Moreover, a procedure to capture so-called composable continuations is provided. As opposed to continuations captured by
call-with-current-continuation
, invoking a composable continuation does not abort the then-current continuation, so composable continuations behave like ordinary procedures. Together with continuation prompts, composable continuations allow one to implement the various proposed sets of control operators for delimited continuations. Finally, a primitive (
call-in-continuation
) is provided that allows calling a procedure in a given continuation instead of just delivering values to it.
Continuation Marks
Continuation marks are a provided feature that allows one to attach arbitrary information to continuation frames that is captured and reinstated along with the rest of the continuation. Conceptually, exception handlers and parameters are implemented in terms of continuation marks, but the syntax and procedures defined in this SRFI allow the user to use them in more general ways. Moreover, they reify the notion of a tail call, allowing one, for example, to test for tail context.
Exceptions
The exception mechanism of
R6RS
and
R7RS
is reinterpreted with respect to the concepts introduced in this SRFI. (Here, and in what follows we mean the so-called small language when we speak about
R7RS
.) Moreover, the
with-exception-handler
procedure and the
guard
syntax gain additional tail-context guarantees.
Parameters
The parameter object mechanism of
SRFI 39
and
R7RS
is reinterpreted with respect to the concepts introduced in this SRFI. Procedures to retrieve the current parameterization and to reinstall it later are provided. Moreover, the
parameterize
syntax gains an additional tail-context guarantee. To support an alternative model of parameters that is linked to the dynamic extent and not to the current parameterization, the notion of a parameter-like object and the
temporarily
syntax are introduced.
Fluids
Fluids are a syntactic reinterpretation of parameter objects.
Delayed evaluation
The syntax and procedures on delayed evaluation of
R7RS
are revisited and redefined to handle the following satisfactorily: the parameterization of the delayed expression being forced, the treatment of exceptions raised during forcing of delayed expressions, and iterative lazy algorithms. Moreover, their semantics are detailed with respect to the concepts introduced in this SRFI, and promises can naturally deliver an arbitrary number of values when being forced. Finally, the initial continuation of a delayed expression being forced is defined in a way that makes it interchangeable with the initial continuation of a thread.
Threads
The thread mechanism of
SRFI 18
is detailed with respect to the concepts introduced in this SRFI. In particular, mutation of parameter objects in multi-threaded applications is specified. In order to support timeout arguments in a type-safe way, a minimal API on time objects is included as well.
Large parts of this SRFI have been inspired by the control operators provided by
Racket
225
Dictionaries
, by John Cowan (spec) and Arvydas Silanskas (implementation)
Final:
2022-09-27
Keywords:
Data Structure
See also
SRFI 146: Mappings
and
SRFI 167: Ordered Key Value Store
The procedures of this SRFI allow callers to manipulate an object that maps keys to values without the caller needing to know exactly what the type of the object is. Such an object is called a
dictionary
or
dict
in this SRFI.
224
Integer Mappings
, by Wolfgang Corcoran-Mathe
Final:
2021-06-30
Keywords:
Data Structure
See also
SRFI 146: Mappings
and
SRFI 189: Maybe and Either: optional container types
Integer maps, or
fxmappings
, are finite sets, where each element is an association between a fixnum (exact integer) key and an arbitrary Scheme object. They are similar to the general mappings of
SRFI 146
, but the restricted key-type allows implementations of fxmappings to benefit from optimized structures and algorithms. This library provides a rich set of operations on fxmappings, including analogues of most of the forms provided by SRFI 146. Fxmappings have no intrinsic order, but may be treated as ordered sets, using the natural ordering on keys; a substantial sublibrary for working with fxmappings in this fashion is included.
223
Generalized binary search procedures
, by Daphne Preston-Kendal
Final:
2021-07-27
Keywords:
Miscellaneous
Library name: bisect
See also
SRFI 43: Vector library
and
SRFI 133: Vector Library (R7RS-compatible)
Generalized procedures for binary search of vector-like data structures are provided which can be applied to any sequence type, including ones defined by the user, together with applications of these procedures for Scheme’s built-in vectors.
222
Compound Objects
, by John Cowan (text) and Arvydas Silanskas (implementation)
Final:
2021-07-20
Keywords:
Data Structure
Compound objects are analogous to R6RS compound conditions, and are suitable for use in creating and handling conditions on non-R6RS systems, among other purposes. They encapsulate an immutable sequence of subobjects, which can be any object except another compound object. It is possible to implement R6RS compound conditions on top of compound objects, but not vice versa. Note that this SRFI does not provide any analogue to R6RS
simple
conditions, which are just records.
221
Generator/accumulator sub-library
, by John Cowan (text) and Arvydas Silanskas (implementation)
Final:
2021-05-28
Keywords:
Data Structure
See also
SRFI 158: Generators and Accumulators
This is a set of convenience routines for generators and accumulators intended to blend in with
SRFI 158
. The authors recommend that they be added to the
(srfi 158)
library provided by users or implementations. If they are approved by the R7RS-large process, they can also be added to
(r7rs generator)
220
Line directives
, by Lassi Kortela
Withdrawn:
2021-04-20
Keywords:
Reader Syntax
Many language-agnostic programming tools rely on specially formatted source code comments to annotate the code with metadata. Such "magic comments" are hard for both humans and computers to parse reliably, as the purpose of a comment is to be free-form text that is not interpreted by machine.
This SRFI extends the standard Scheme directive syntax (
#!
) to support
line directives
. They look like magic comments to language-agnostic tools but read as S-expressions in Scheme, combining the portability of magic comments with the well-defined syntax and easy parsing of ordinary Scheme code.
219
Define higher-order lambda
, by Lassi Kortela
Final:
2021-04-04
Keywords:
Binding
Syntax
Library name: define
See also
SRFI 201: Syntactic Extensions to the Core Scheme Bindings
and
SRFI 232: Flexible curried procedures
This SRFI codifies the following shorthand syntax, which some Scheme implementations have had for a long time.
(define ((outer-name outer-args ...) inner-args ...) inner-body ...)
218
Unicode Numerals
, by John Cowan (text) and Arvydas Silanskas (implementation)
Withdrawn:
2021-01-30
Keywords:
Internationalization
These procedures allow the creation and interpretation of numerals using any set of Unicode digits that support positional notation.
217
Integer Sets
, by John Cowan (text) and Wolfgang Corcoran-Mathe (implementation)
Final:
2021-02-15
Keywords:
Data Structure
See also
SRFI 113: Sets and bags
Integer sets, or
iset
s, are unordered collections of fixnums. (Fixnums are exact integers within certain implementation-specified bounds.)
216
SICP Prerequisites (Portable)
, by Vladimir Nikishkin
Final:
2021-01-21
Keywords:
SICP
See also
SRFI 203: A Simple Picture Language in the Style of SICP
This SRFI follows
SRFI 203
in providing "out-of-the-box" support for hosting the exercises suggested by
Structure and Interpretation of Computer Programs
in portable Scheme.
Whereas SRFI 203 focused on the necessarily non-portable aspects of the problem set (the graphics), this SRFI aims to provide support for the rest of the features, which are far more widespread, often already provided, and in reality mostly need just a common vocabulary.
This SRFI provides procedures for working with time data, multi-threading, and streams, as well as SICP names for
true
and
false
None of these procedures is fit for production use. They are only designed for pedagogical purposes.
Students, however, are expected to be able to just write
(include (srfi sicp))
and have the code from the book run without problems (apart from those intended by the book authors).
215
Central Log Exchange
, by Göran Weinholt
Final:
2021-01-11
Keywords:
Operating System
Library name: logging
This SRFI specifies a central log exchange for Scheme that
connects log producers with log consumers. It allows multiple
logging systems to interoperate and co-exist in the same
program. Library code can produce log messages without knowledge
of which log system is actually used. Simple applications can
easily get logs on standard output, while more advanced
applications can send them to a full logging system.
214
Flexvectors
, by Adam Nelson
Final:
2021-03-18
Keywords:
Data Structure
See also
SRFI 117: Queues based on lists
SRFI 125: Intermediate hash tables
SRFI 133: Vector Library (R7RS-compatible)
SRFI 134: Immutable Deques
, and
SRFI 158: Generators and Accumulators
flexvector
, also known as a dynamic array or an arraylist, is a mutable vector-like data structure with an adjustable size. Flexvectors allow fast random access and fast insertion/removal at the end. This SRFI defines a suite of operations on flexvectors, modeled after
SRFI 133
's vector operations.
213
Identifier Properties
, by Marc Nieper-Wißkirchen
Final:
2021-03-21
Keywords:
Binding
Syntax
Using the
define-property
definition described in this SRFI, expand-time properties can be associated with identifiers in a referentially transparent and lexically scoped way.
212
Aliases
, by Marc Nieper-Wißkirchen
Final:
2021-02-12
Keywords:
Syntax
This SRFI introduces
alias definitions
, a syntactic extension. An alias definition transfers the binding of one identifier to another, effectively aliasing the identifier.
211
Scheme Macro Libraries
, by Marc Nieper-Wißkirchen
Final:
2022-07-19
Keywords:
Syntax
See also
SRFI 46: Basic Syntax-rules Extensions
SRFI 93: R6RS Syntax-Case Macros
, and
SRFI 139: Syntax parameters
This SRFI describes common syntactic extensions of the
syntax-rules
macro facility of R5RS and the base R6RS and R7RS libraries. In particular, library namespaces are defined where these extensions can be located and which can be tested against in
cond-expand
forms.
210
Procedures and Syntax for Multiple Values
, by Marc Nieper-Wißkirchen
Final:
2021-02-12
Keywords:
Binding
Multiple-Value Returns
See also
SRFI 8: receive: Binding to multiple values
SRFI 11: Syntax for receiving multiple values
, and
SRFI 71: Extended LET-syntax for multiple values
This SRFI extends the Scheme standard with procedures and syntax dealing with multiple values, including syntax to create lists and vectors from expressions returning multiple values and procedures returning the elements of a list or vector as multiple values.
209
Enums and Enum Sets
, by John Cowan (text) and Wolfgang Corcoran-Mathe (implementation)
Final:
2020-12-17
Keywords:
Data Structure
Enums are objects that serve to form sets of distinct classes that specify different modes of operation for a procedure. Their use fosters portable and readable code.
208
NaN procedures
, by Emmanuel Medernach (design), John Cowan (editor), and Wolfgang Corcoran-Mathe (implementation)
Final:
2021-02-23
Keywords:
Data Structure
Numbers
This SRFI provides procedures that dissect NaN (Not a Number) inexact values.
207
String-notated bytevectors
, by Daphne Preston-Kendal (external notation), John Cowan (procedure design), and Wolfgang Corcoran-Mathe (implementation)
Final:
2020-10-29
Keywords:
Reader Syntax
Library name: bytestrings
To ease the human reading and writing of Scheme code involving binary data that for mnemonic reasons corresponds as a whole or in part to ASCII-coded text, a notation for bytevectors is defined which allows printable ASCII characters to be used literally without being converted to their corresponding integer forms. In addition, this SRFI provides a set of procedures known as the bytestring library for constructing a bytevector from a sequence of integers, characters, strings, and/or bytevectors, and for manipulating bytevectors as if they were strings as far as possible.
206
Auxiliary Syntax Keywords
, by Marc Nieper-Wißkirchen
Final:
2020-12-21
Keywords:
Syntax
See also
SRFI 139: Syntax parameters
and
SRFI 213: Identifier Properties
This SRFI defines a mechanism for defining auxiliary syntax keywords independently in different modules in such a way that they still have the same binding so that they can be used interchangeably as literal identifiers in
syntax-rules
and
syntax-case
expressions and can be both imported under the same name without conflicts.
205
POSIX Terminal Fundamentals
, by John Cowan and Harold Ancell
Withdrawn:
2022-03-21
Keywords:
Operating System
See also
SRFI 170: POSIX API
and
SRFI 198: Foreign Interface Status
This SRFI describes procedures for command-line and terminal interface programs to safely change and reset terminal modes, for example from cooked to raw and back, and for serial-line device manipulation for interfacing with embedded hardware and the like.
It is intended to provide all the
termios structure
functionality a modern Scheme programmer might desire by supplying a
stty
procedure, and simple abstractions on top of it.
204
Wright-Cartwright-Shinn Pattern Matcher
, by Felix Thibault
Withdrawn:
2022-02-02
Keywords:
Pattern Matching
See also
SRFI 200: Pattern Matching
SRFI 201: Syntactic Extensions to the Core Scheme Bindings
SRFI 204: Wright-Cartwright-Shinn Pattern Matcher
, and
SRFI 241: Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data
Pattern matching decomposes a compound data structure into parts and assigns those parts to variables. This SRFI describes a pattern-matching library already in use by several scheme implementations which can match many common compound data structures.
203
A Simple Picture Language in the Style of SICP
, by Vladimir Nikishkin
Final:
2020-09-17
Keywords:
SICP
See also
SRFI 216: SICP Prerequisites (Portable)
This SRFI proposes a simple library for programmatic drawing of pictures compatible with Section 2.2.4 of
Structure and Interpretation of Computer Programs
It aims to close the gap between the Scheme suggested for study in the book and portable Scheme.
202
Pattern-matching Variant of the and-let* Form that Supports Multiple Values
, by Panicz Maciej Godek
Final:
2020-11-28
Keywords:
Binding
Control Flow
Pattern Matching
See also
SRFI 2: AND-LET*: an AND with local bindings, a guarded LET* special form
and
SRFI 200: Pattern Matching
The SRFI-2 library introduced the
and-let*
form for short-circuited evaluation in the style of the
and
form, with the ability to capture the (non-
#f
) results in the style of the
let*
form. This document extends the
and-let*
form with the ability to pattern-match (or "destructurally bind") the values of evaluated expressions (where the match failure causes short-circuiting rather than raising an error) and the ability to handle multiple values (where only the falsehood of the first value causes short-circuiting).
201
Syntactic Extensions to the Core Scheme Bindings
, by Panicz Maciej Godek
Final:
2021-01-13
Keywords:
Binding
Pattern Matching
Syntax
See also
SRFI 8: receive: Binding to multiple values
SRFI 11: Syntax for receiving multiple values
SRFI 71: Extended LET-syntax for multiple values
SRFI 200: Pattern Matching
, and
SRFI 219: Define higher-order lambda
This document describes a handful of syntactic extensions to the core bindings of the Scheme programming language. In particular, it proposes to extend the binding forms
lambda
let
let*
with pattern matching capabilities, to extend the forms
let
and
or
with the ability to handle multiple values, and to extend the form
define
with the ability of defining "curried" functions.
200
Pattern Matching
, by Panicz Maciej Godek
Withdrawn:
2022-07-23
Keywords:
Pattern Matching
See also
SRFI 204: Wright-Cartwright-Shinn Pattern Matcher
SRFI 241: Match — Simple Pattern-Matching Syntax to Express Catamorphisms on Scheme Data
SRFI 257: Simple extendable pattern matcher with backtracking
, and
SRFI 262: Extensible pattern matcher
This SRFI discusses some of the existing pattern-matching libraries for the Scheme programming language — namely, the pattern matcher presented by Andrew K. Wright and Robert Cartwright in the paper "A Soft Type System for Scheme", the pattern matcher developed by Dan Friedman, Erik Hilsdale and Kent Dybvig, the
racket/match
module distributed with the Racket programming environment, as well as the Bigloo and Gerbil pattern matchers distributed with their respective implementations. It then extracts a pattern syntax which is compatible with three of those implementations and provides extrinsic rationale for that syntax. It also provides a simple implementation of a pattern matcher which conforms to the specification of a pattern language provided in this document.
199
POSIX errno manipulation
, by Harold Ancell
Withdrawn:
2020-07-19
Keywords:
Error Handling
Operating System
See also
SRFI 170: POSIX API
and
SRFI 198: Foreign Interface Status
The majority of P
OSIX
system and library calls
require accessing
errno
to discern the specific cause
of an error, and some require setting it to 0 before being called.
This SRFI specifies procedures to both retrieve its value, and to
set it.
198
Foreign Interface Status
, by John Cowan (editor and shepherd), Harold Ancell (implementer and editor), and Lassi Kortela (architect)
Withdrawn:
2020-09-12
Keywords:
Error Handling
Operating System
See also
SRFI 170: POSIX API
This SRFI provides means to construct, return or signal, and extract
information from Scheme interfaces with "foreign" systems such as the
OSIX
API, databases, and libraries.
197
Pipeline Operators
, by Adam Nelson
Final:
2020-09-12
Keywords:
Syntax
Many functional languages provide pipeline operators, like Clojure's
->
or OCaml's
|>
. Pipelines are a simple, terse, and readable way to write deeply-nested expressions. This SRFI defines a family of
chain
and
nest
pipeline operators, which can rewrite nested expressions like
(a b (c d (e f g)))
as a sequence of operations:
(chain g (e f _) (c d _) (a b _))
196
Range Objects
, by John Cowan (text) and Wolfgang Corcoran-Mathe (sample implementation)
Final:
2020-09-17
Keywords:
Data Structure
See also
SRFI 42: Eager Comprehensions
Ranges are collections somewhat similar to vectors, except that they are immutable and have algorithmic representations instead of the uniform per-element data structure of vectors. The storage required is usually less than the size of the same collection stored in a vector and the time needed to reference a particular element is typically less for a range than for the same collection stored in a list. This SRFI defines a large subset of the sequence operations defined on lists, vectors, strings, and other collections. If necessary, a range can be converted to a list, vector, or string of its elements or a generator that will lazily produce each element in the range.
195
Multiple-value boxes
, by Marc Nieper-Wißkirchen
Final:
2020-08-28
Keywords:
Data Structure
Multiple-Value Returns
See also
SRFI 111: Boxes
and
SRFI 189: Maybe and Either: optional container types
This SRFI extends the specification of the boxes of
SRFI 111
so that they are multiple-values aware. Whereas a SRFI 111 box is limited in that it can only box a single value, multiple values can be boxed with this SRFI.
194
Random data generators
, by Shiro Kawai (design), Arvydas Silanskas (implementation), John Cowan (editor and shepherd), and Linas Vepštas (implementation)
Final:
2020-08-26
Keywords:
Randomness
See also
SRFI 27: Sources of Random Bits
This SRFI defines a set of
SRFI 158
generators and generator makers that yield random data of specific ranges and distributions. It is intended to be implemented on top of
SRFI 27
, which provides the underlying source of random integers and floats.
193
Command line
, by Lassi Kortela
Final:
2020-09-10
Keywords:
Operating System
See also
SRFI 22: Running Scheme Scripts on Unix
RS and R
RS define a
command-line
procedure. While a useful baseline, the specification is not detailed enough to cover all practical situations. This SRFI clarifies the definition of
command-line
and adds a few related procedures. Scheme scripts, standalone executables, compilation and REPL use are accounted for. Option parsing is out of scope.
192
Port Positioning
, by John Cowan and Shiro Kawai (implementation; requires a hook)
Based on R6RS.
Final:
2020-07-31
Keywords:
I/O
See also
SRFI 181: Custom ports (including transcoded ports)
This is an extract from the R6RS that documents its support for
positioning ports. Binary ports can be positioned to read or write
at a specific byte; textual ports at a specific character,
although character positions can't be synthesized portably.
It has been lightly edited to fit R7RS style.
191
Procedure Arity Inspection
, by John Cowan
Based on SRFI 102.
Withdrawn:
2020-07-05
Keywords:
Introspection
See also
SRFI 102: Procedure Arity Inspection
and
SRFI 151: Bitwise Operations
Many Scheme systems provide mechanisms for inspecting the arity of a
procedural value, making it a common feature, however there is no
standard interface. As a result there is no portable way to observe
the arity of a procedure without actually applying it. This
SRFI proposes a simple interface that is consistent with existing
Scheme systems' facilities and prior proposals.
190
Coroutine Generators
, by Marc Nieper-Wißkirchen
Final:
2020-06-11
Keywords:
Syntax
See also
SRFI 121: Generators
SRFI 139: Syntax parameters
, and
SRFI 158: Generators and Accumulators
This SRFI defines syntax to create
SRFI
121
158
coroutine generators conveniently and in the flavor of Python
generator functions.
189
Maybe and Either: optional container types
, by John Cowan (text) and Wolfgang Corcoran-Mathe (sample implementation)
Final:
2020-07-14
Keywords:
Data Structure
Multiple-Value Returns
See also
SRFI 195: Multiple-value boxes
This SRFI defines two disjoint immutable container types known as Maybe and Either, both of which can contain objects collectively known as their payload. A Maybe object is either a Just object or the unique object Nothing (which has no payload); an Either object is either a Right object or a Left object. Maybe represents the concept of optional values; Either represents the concept of values which are either correct (Right) or errors (Left).
Note that the terms Maybe, Just, Nothing, Either, Right, and Left are capitalized in this SRFI so as not to be confused with their ordinary use as English words. Thus "returns Nothing" means "returns the unique Nothing object"; "returns nothing" could be interpreted as "returns no values" or "returns an unspecified value".
188
Splicing binding constructs for syntactic keywords
, by Marc Nieper-Wißkirchen
Final:
2020-06-03
Keywords:
Syntax
See also
SRFI 93: R6RS Syntax-Case Macros
and
SRFI 148: Eager syntax-rules
Splicing binding constructs for syntactic keywords are versions of
let-syntax
and
letrec-syntax
that can be used in a definition context in the same way as
begin
187
ALAMBDA and ADEFINE
, by Joo ChurlSoo
Based on SRFI 92.
Withdrawn:
2020-03-27
Keywords:
Miscellaneous
Type Checking
See also
SRFI 92: ALAMBDA and ALAMBDA*
and
SRFI 182: ADBMAL, ALET, and ALET*
This SRFI introduces alambda, which creates a procedure that checks its actual arguments, takes various types of required and optional variables.
This SRFI is based on
SRFI 92
as an extension of the optional arguments of
SRFI 182
186
Transcoders and transcoded ports
, by John Cowan
Based on R6RS.
Withdrawn:
2020-09-08
Keywords:
I/O
Superseded
See also
SRFI 80: Stream I/O
SRFI 81: Port I/O
, and
SRFI 181: Custom ports (including transcoded ports)
This is an extract from the R6RS that documents its support for transcoders and transcoded ports. These provide a hook into the Scheme port system from below, allowing the creation of textual ports that provide non-default encoding and decoding from arbitrary binary ports. It has been lightly edited to fit R7RS style.
185
Linear adjustable-length strings
, by John Cowan
Final:
2020-04-26
Keywords:
Data Structure
Text
See also
SRFI 13: String Libraries
SRFI 118: Simple adjustable-size strings
SRFI 130: Cursor-based string library
SRFI 140: Immutable Strings
, and
SRFI 152: String Library (reduced)
Scheme specifies mutable fixed-length strings.
SRFI 118
adds two procedures,
string-append!
and
string-replace!
, which allow the length of the string to change.
This SRFI provides two linear-update versions of these procedures:
that is, the implementation may change the string length or return a
new string instead.
In addition, two convenience macros are provided that make the
procedures somewhat easier to use.
184
define-record-lambda
, by Joo ChurlSoo
Withdrawn:
2020-03-27
Keywords:
Data Structure
Record Type
See also
SRFI 9: Defining Record Types
and
SRFI 100: define-lambda-object
This SRFI introduces a macro, DEFINE-RECORD-LAMBDA, that defines a set of procedures, that is, a group of constructors and a predicate. The constructors also make a group of procedures, namely record lambdas, that have no explicit field accessors and mutators. They can have various kinds of fields, such as common fields, required fields, optional fields, automatic fields, read-only fields, read-write fields, invisible fields, immutable fields, and virtual fields.
183
Another format procedure, Fox
, by Joo ChurlSoo
Withdrawn:
2020-03-27
Keywords:
I/O
See also
SRFI 54: Formatting
This SRFI introduces the formatting procedure Fox ("format of X"), which takes one required argument and a variable number of additional arguments and returns a formatted string.
182
ADBMAL, ALET, and ALET*
, by Joo ChurlSoo
Withdrawn:
2020-03-27
Keywords:
Data Structure
Multiple-Value Returns
See also
SRFI 2: AND-LET*: an AND with local bindings, a guarded LET* special form
SRFI 11: Syntax for receiving multiple values
SRFI 51: Handling rest list
SRFI 54: Formatting
SRFI 71: Extended LET-syntax for multiple values
, and
SRFI 86: MU and NU simulating VALUES & CALL-WITH-VALUES, and their related LET-syntax
Unlike the VALUES and CALL-WITH-VALUES mechanism of R5RS, this one uses an explicit representation for multiple return values as a single value, namely a procedure. Decomposition of multiple values is done by simple application. The macro, ADBMAL, evaluates to a procedure that takes one procedure argument. The ADBMAL macro can be compared with LAMBDA. While a LAMBDA expression that consists of
This SRFI also introduces the new LET-syntax ALET and ALET*, which depend on ADBMAL to manipulate multiple values, and which are compatible with LET and LET* of R5RS in single-value bindings. They also have a binding form making use of VALUES and CALL-WITH-VALUES to handle multiple values, and new binding forms for list, cons, and other multiple values. In addition, they have several new binding forms for useful functions such as escape, iteration, optional arguments, etc.
181
Custom ports (including transcoded ports)
, by John Cowan
Based on R6RS.
Final:
2020-09-08
Keywords:
I/O
See also
SRFI 79: Primitive I/O
SRFI 81: Port I/O
SRFI 82: Stream Ports
SRFI 91: Extended ports
SRFI 186: Transcoders and transcoded ports
, and
SRFI 192: Port Positioning
This SRFI is derived from parts of
library section 8.2.4
library section 8.2.7
library section 8.2.10
, and
library section 8.2.13
of the R6RS. These sections are themselves based on parts of
SRFI 79
SRFI 80
and
SRFI 81
. These procedures provide a hook into the Scheme port system from below, allowing the creation of custom ports that behave as much as possible like the standard file, string, and bytevector ports, but that call a procedure to produce data to input ports or to consume data from output ports. Procedures for creating ports that transcode between bytes and characters are an important special case and are also documented in this SRFI.
180
JSON
, by Amirouche Boubekki
Final:
2020-07-01
Keywords:
I/O
This library describes a JavaScript Object Notation (JSON) parser and printer. It supports JSON that may be bigger than memory.
179
Nonempty Intervals and Generalized Arrays (Updated)
, by Bradley J. Lucier
Final:
2020-06-30
Keywords:
Data Structure
Numbers
See also
SRFI 122: Nonempty Intervals and Generalized Arrays
SRFI 164: Enhanced multi-dimensional Arrays
, and
SRFI 231: Intervals and Generalized Arrays
This SRFI specifies an array mechanism for Scheme. Arrays as defined here are quite general; at their most basic, an array is simply a mapping, or function, from multi-indices of exact integers $i_0,\ldots,i_{d-1}$ to Scheme values. The set of multi-indices $i_0,\ldots,i_{d-1}$ that are valid for a given array form the
domain
of the array. In this SRFI, each array's domain consists of the cross product of nonempty intervals of exact integers $[l_0,u_0)\times[l_1,u_1)\times\cdots\times[l_{d-1},u_{d-1})$ of $\mathbb Z^d$, $d$-tuples of integers. Thus, we introduce a data type called $d$-
intervals
, or more briefly
intervals
, that encapsulates this notion. (We borrow this terminology from, e.g., Elias Zakon's
Basic Concepts of Mathematics
.) Specialized variants of arrays are specified to provide portable programs with efficient representations for common use cases.
178
Bitvector library
, by John Cowan (text) and Wolfgang Corcoran-Mathe (implementation)
Final:
2020-08-25
Keywords:
Data Structure
See also
SRFI 151: Bitwise Operations
and
SRFI 160: Homogeneous numeric vector libraries
This SRFI describes a set of operations on homogeneous bitvectors. Operations analogous to those provided on the other homogeneous vector types described in
SRFI 160
are provided, along with operations analogous to the bitwise operations of
SRFI 151
177
Portable keyword arguments
, by Lassi Kortela
Withdrawn:
2020-07-31
Keywords:
Binding
See also
SRFI 88: Keyword objects
and
SRFI 89: Optional positional and named parameters
Many Scheme implementations have keyword arguments, but they have not been widely standardized. This SRFI defines the macros
lambda/kw
and
call/kw
. They can be used identically in every major implementation currently in use, making it safe to use keyword arguments in portable code. The macros expand to native keyword arguments in Schemes that have them, letting programmers mix portable code and implementation-specific code.
176
Version flag
, by Lassi Kortela
Final:
2020-02-24
Keywords:
Operating System
Library name: version
This SRFI defines a standard command-line flag to get version information from a Scheme implementation. The output is Line-oriented S-expressions which are easy to parse from Scheme, C, and shell scripts and can co-exist with non-S-expression output. A standard vocabulary is defined; extensions are easy to make.
175
ASCII character library
, by Lassi Kortela
Final:
2019-12-20
Keywords:
Data Structure
Library name: ascii
This SRFI defines ASCII-only equivalents to many of the character procedures in standard Scheme plus a few extra ones. Recent Scheme standards are based around Unicode but the significant syntactic elements in many file formats and network protocols are all ASCII. Such low-level code can run faster and its behavior can be easier to understand when it uses ASCII primitives.
174
POSIX Timespecs
, by John Cowan
Final:
2019-12-21
Keywords:
Data Structure
See also
SRFI 19: Time Data Types and Procedures
and
SRFI 170: POSIX API
This SRFI defines the trivial type
timespec
, which is used to represent the
struct timespec
defined by the
OSIX
header
173
Hooks
, by Amirouche Boubekki
Final:
2019-10-24
Keywords:
Miscellaneous
This library describes a mechanism known as hooks. Hooks are a certain kind of extension point in a program that allows interleaving the execution of arbitrary code with the execution of the program without introducing any coupling between the two.
172
Two Safer Subsets of R7RS
, by John Cowan
Final:
2019-11-10
Keywords:
Miscellaneous
This SRFI provides two libraries for use with R7RS that provide a way to sandbox the
eval
procedure to make it safer to use in evaluating Scheme expressions of doubtful provenance. The intention is to call
eval
, passing it an S-expression representing a Scheme procedure and the environment defined by one of these libraries. Since code evaluated by
eval
runs in a null lexical environment, the resulting procedure can then be invoked with less concern about possible side effects.
Use of these libraries does not provide any sort of safety guarantee. There are still many loopholes uncaught, including attempts to process circular structure and over-allocation of memory. The claim is only that the probability of such an attack is reduced, not that it is eliminated. However, using these libraries is a simple provision that is easy to implement and easy to use. For higher safety, it can readily be combined with other provisions.
171
Transducers
, by Linus Björnstam
Final:
2019-10-26
Keywords:
Data Structure
A library implementing transducers — composable algorithmic transformations. Scheme has many different ways of expressing transformations over different collection types, but they are all unique to whatever base type they work on. This SRFI proposes a new construct, the transducer, that is oblivious to the context in which it is being used.
170
POSIX API
, by Olin Shivers (original author), John Cowan (editor and shepherd), and Harold Ancell (implementer and editor)
Based on scsh by Olin Shivers.
Final:
2020-10-28
Keywords:
Operating System
See also
SRFI 198: Foreign Interface Status
The host environment is the set of resources, such as the filesystem, network and processes, that are managed by the operating system on top of which a Scheme program is executing. This SRFI specifies some of the ways the host environment can be accessed from within a Scheme program. It does so by leveraging widespread support for P
OSIX
, the Portable Operating System Interface standardized by the IEEE. Not all of the functions of this SRFI are available on all operating systems.
169
Underscores in numbers
, by Lassi Kortela
Final:
2019-07-26
Keywords:
Numbers
Reader Syntax
Many people find that large numbers are easier to read when the digits are broken into small groups. For example, the number
1582439
might be easier to read if written as
1 582 439
. This applies to source code as it does to other writing. We propose an extension of Scheme syntax to allow the underscore as a digit separator in numerical constants.
168
Generic Tuple Store Database
, by Amirouche Boubekki
Final:
2019-11-08
Keywords:
I/O
See also
SRFI 167: Ordered Key Value Store
and
SRFI 173: Hooks
This library is a generic approach to the database abstractions known as triplestore and quadstore. Generic Tuple Store Database implements n-tuple ordered sets and associated primitives for working with them in the context of data management.
167
Ordered Key Value Store
, by Amirouche Boubekki
Final:
2019-11-08
Keywords:
I/O
See also
SRFI 168: Generic Tuple Store Database
and
SRFI 173: Hooks
This library describes an interface for an ordered key-value store that is suitable for implementing a storage engine for the generic tuple-store SRFI. It maps cleanly to existing ordered key-value databases that may or may not provide transactions.
166
Monadic Formatting
, by Alex Shinn
Final:
2020-07-30
Keywords:
I/O
Text
See also
SRFI 13: String Libraries
SRFI 159: Combinator Formatting
, and
SRFI 165: The Environment Monad
A library of procedures for formatting Scheme objects to text in various ways, and for easily concatenating, composing and extending these formatters efficiently without resorting to capturing and manipulating intermediate strings.
This SRFI is an updated version of SRFI 159, primarily with the difference that state variables are hygienic.
Summary of differences from SRFI 159:
State variables are first class and hygienic
Added
written-shared
pretty-shared
Added
as-italic
as-color
as-true-color
on-
color
background variants, and
pretty-with-color
Added
ambiguous-is-wide?
state variable and
string-terminal-width/wide
utility
Added
substring/width
state var for width-aware substring operations, with
substring-terminal-width(/wide)
utilities
Added
substring/preserve
state var used in trimming, with
substring-terminal-preserve
utility
Added
pretty-environment
state variable
Renamed
as-unicode
to
terminal-aware
Restored non-uniform comma rules as needed in India
Restored
upcased
and
downcased
Several clarifications and more examples
165
The Environment Monad
, by Marc Nieper-Wißkirchen
Final:
2019-09-05
Keywords:
Miscellaneous
See also
SRFI 159: Combinator Formatting
and
SRFI 166: Monadic Formatting
Monads model computations. The environment monad models computations that depend on values from a shared environment. These computations can read values from the environment, pass values to subsequent computations, execute sub-computations in an extended environment, and modify the environment for future computations.
164
Enhanced multi-dimensional Arrays
, by Per Bothner
Final:
2019-08-08
Keywords:
Data Structure
See also
SRFI 4: Homogeneous numeric vector datatypes
SRFI 25: Multi-dimensional Array Primitives
SRFI 122: Nonempty Intervals and Generalized Arrays
, and
SRFI 163: Enhanced array literals
This SRFI describes the array data type (a generalization of vectors to multiple indexes or dimensions), along with a set of procedures for working on them.
This specification is an extension of
SRFI 25
, with additions from Racket’s
math.array
package and other sources. It has been implemented in the
Kawa dialect of Scheme
163
Enhanced array literals
, by Per Bothner
Final:
2019-01-18
Keywords:
Reader Syntax
See also
SRFI 4: Homogeneous numeric vector datatypes
SRFI 25: Multi-dimensional Array Primitives
SRFI 48: Intermediate Format Strings
SRFI 58: Array Notation
SRFI 58: Array Notation
SRFI 122: Nonempty Intervals and Generalized Arrays
SRFI 160: Homogeneous numeric vector libraries
SRFI 164: Enhanced multi-dimensional Arrays
, and
SRFI 268: Multidimensional Array Literals
This is a specification of a reader form (literals) for multi-dimensional arrays. It is an extension of the Common Lisp array reader syntax to handle non-zero lower bounds, optional explicit bounds, and optional uniform element types (compatible with
SRFI 4
). It can be used in conjunction with
SRFI 25
SRFI 122
, or
SRFI 164
. These extensions were implemented in Guile (except the handling of rank-0 arrays), and later in Kawa.
There are recommendations for output formatting and a suggested
format-array
procedure.
162
Comparators sublibrary
, by John Cowan
Final:
2019-08-27
Keywords:
Comparison
See also
SRFI 114: Comparators
and
SRFI 128: Comparators (reduced)
This SRFI provides a few extra procedures and comparators to go with SRFI 128, Comparators. Implementers are urged to add them to their SRFI 128 libraries, for which reason they are not packaged as a separate library.
161
Unifiable Boxes
, by Marc Nieper-Wißkirchen
Final:
2019-02-08
Keywords:
Data Structure
See also
SRFI 111: Boxes
Unifiable boxes are, like the boxes of
SRFI 111
, objects with a single mutable state. A constructor, predicate, accessor, and mutator are provided.
In addition to this, an equality predicate and union operations (link, union, unify) are provided. Applying a union operation to two unifiable boxes makes the two boxes equal (in the sense of the equality predicate). As a consequence, their state will also become identical. In the case of link and union, it will be the state of one of the two unioned boxes. In the case of unify, the state is determined by a supplied unification procedure.
Unifiable boxes are also known under the names
disjoint-set data structure
union–find data structure
or
merge–find set
160
Homogeneous numeric vector libraries
, by John Cowan and Shiro Kawai (contributed a major patch)
Based on SRFI 4 by Marc Feeley.
Final:
2019-08-27
Keywords:
Data Structure
R7RS Large
R7RS Large: Tangerine Edition
See also
SRFI 4: Homogeneous numeric vector datatypes
SRFI 74: Octet-Addressed Binary Blocks
SRFI 133: Vector Library (R7RS-compatible)
, and
SRFI 152: String Library (reduced)
This SRFI describes a set of operations on SRFI 4 homogeneous vector types (plus a few additional types) that are closely analogous to the vector operations library,
SRFI 133
. An external representation is specified which may be supported by the
read
and
write
procedures and by the program parser so that programs can contain references to literal homogeneous vectors.
159
Combinator Formatting
, by Alex Shinn
Withdrawn:
2020-07-31
Keywords:
I/O
R7RS Large
R7RS Large: Tangerine Edition
Superseded
Text
See also
SRFI 28: Basic Format Strings
SRFI 48: Intermediate Format Strings
, and
SRFI 166: Monadic Formatting
A library of procedures for formatting Scheme objects to text in various ways, and for easily concatenating, composing and extending these formatters efficiently without resorting to capturing and manipulating intermediate strings.
158
Generators and Accumulators
, by Shiro Kawai, John Cowan, and Thomas Gilray
Final:
2017-10-27
Keywords:
Data Structure
R7RS Large
R7RS Large: Tangerine Edition
Library name: generators-and-accumulators
See also
SRFI 121: Generators
This SRFI defines utility procedures that create, transform, and consume generators. A generator is simply a procedure with no arguments that works as a source of values. Every time it is called, it yields a value. Generators may be finite or infinite; a finite generator returns an end-of-file object to indicate that it is exhausted. For example,
read-char
read-line
, and
read
are generators that generate characters, lines, and objects from the current input port. Generators provide lightweight laziness.
This SRFI also defines procedures that return accumulators. An accumulator is the inverse of a generator: it is a procedure of one argument that works as a sink of values.
157
Continuation marks
, by Marc Nieper-Wißkirchen
Withdrawn:
2023-06-29
Keywords:
Continuations
Continuation marks are a programming language feature that allows one to attach information to and retrieve information from continuations, generalizing stack inspection. Conceptually, a continuation consists of a number of frames where each frame stands for an active procedure call that is not a tail call. A continuation mark is then a key-value pair associated with a frame, with keys compared using
eq?
. At most one mark for a given key can be attached to a single frame.
Besides stack inspection, continuation marks can be used to implement dynamic scope, delimited continuations, or delayed evaluation that is able to handle iterative lazy algorithms.
This SRFI proposes to add continuation marks to the Scheme programming language. The interface defined here is modelled after Racket's continuation marks. It does not include all forms and procedures provided by Racket but provides a compatible subset.
156
Syntactic combiners for binary predicates
, by Panicz Maciej Godek
Final:
2017-12-18
Keywords:
Syntax
Library name: predicate-combiners
See also
SRFI 26: Notation for Specializing Parameters without Currying
Recognizing binary predicates as a specific area in which the use of prefix operators is an impediment, we propose a thin layer of "syntactic stevia" for in-fixing such predicates. It can be implemented using regular Scheme macros. We suggest that the code
(is x < y)
should be transformed to
(< x y)
, and
(is x < y <= z)
-- to
(let ((y* y)) (and (< x y*) (<= y* z)))
. In addition, we suggest special meaning to the
symbol:
(is _ < y)
and
(is x < _)
should be transformed to
(lambda (_) (< _ y))
and
(lambda (_) (< x _))
, respectively. This SRFI document also describes some other uses of the
is
macro and its limitations.
155
Promises
, by Marc Nieper-Wißkirchen
Withdrawn:
2023-06-29
Keywords:
Data Structure
Lazy Evaluation
See also
SRFI 45: Primitives for Expressing Iterative Lazy Algorithms
Scheme, like ML, is a programming language with strict evaluation while others, like Haskell, use lazy evaluation. Scheme, however, possesses the primitives
delay
and
force
that make it possible to express lazy algorithms.
Lazy evaluation does not go well in conjunction with imperative, non-functional, side-effecting code. It should, however, be applicable in a purely functional setting. This is the case for the delayed evaluation model as described in the R7RS as long as no dynamically bound variables, also known as parameter objects, are present. It is the purpose of this SRFI to rework the specification in the R7RS so that lazy evaluation works with purely functional code that makes use of dynamic environments or, more generally, the dynamic extent. This is done by remembering the dynamic extent in effect when the
delay
expression is evaluated.
Another perceived misfeature of the R7RS model of delayed evaluation is the apparent need of the
delay-force
special form to express iterative lazy algorithms. It is shown that the
delay-force
special form is unneeded and that the implementation can (and should) handle iterative lazy algorithms without space leaks.
154
First-class dynamic extents
, by Marc Nieper-Wißkirchen
Withdrawn:
2023-06-29
Keywords:
Miscellaneous
See also
SRFI 157: Continuation marks
Scheme has the notion of the
dynamic extent
of a procedure call. A number of standard Scheme procedures and syntaxes like
dynamic-wind
call-with-current-continuation
, and
parameterize
deal with the dynamic extent indirectly. The same holds true for the procedures and syntaxes dealing with continuation marks as defined by
SRFI 157
This SRFI reifies the dynamic extent into a first-class value together with a well-defined procedural interface and a syntax to create procedures that remember not only their environment at creation time but also their dynamic extent, which includes their dynamic environment.
153
Ordered Sets
, by John Cowan
Final:
2023-05-01
Keywords:
Data Structure
See also
SRFI 128: Comparators (reduced)
and
SRFI 146: Mappings
Osets
are immutable collections that can contain any Scheme objects as long as a total order exists among the objects. Osets enforce the constraint that no two elements can be the same in the sense of the oset's associated
equality predicate
. The elements in an oset appear in a fixed order determined by the comparator used to create it.
152
String Library (reduced)
, by John Cowan
Final:
2017-10-04
Keywords:
Data Structure
Text
Library name: strings
See also
SRFI 130: Cursor-based string library
and
SRFI 135: Immutable Texts
Scheme has an impoverished set of string-processing utilities, which is a problem for authors of portable code. This SRFI proposes a coherent and comprehensive set of string-processing procedures. It is a reduced version of SRFI 13 that has been aligned with SRFI 135, Immutable Texts. Unlike SRFI 13, it has been made consistent with the R5RS, R6RS, and R7RS-small string procedures.
151
Bitwise Operations
, by John Cowan
Final:
2017-07-10
Keywords:
Data Structure
R7RS Large
R7RS Large: Tangerine Edition
Numbers
Library name: bitwise-operations
See also
SRFI 142: Bitwise Operations
This SRFI proposes a coherent and comprehensive set of procedures for performing bitwise logical operations on integers; it is accompanied by a reference implementation of the spec in terms of a set of seven core operators. The sample implementation is portable, as efficient as practical with pure Scheme arithmetic (it is much more efficient to replace the core operators with C or assembly language if possible), and open source.
The precise semantics of these operators is almost never an issue. A consistent, portable set of
names
and
parameter conventions
, however, is. Hence this SRFI, which is based mainly on
SRFI 33
, with some changes and additions from
Olin's late revisions to SRFI 33
(which were never consummated).
SRFI 60
(based on SLIB) is smaller but has a few procedures of its own; some of its procedures have both native (often Common Lisp) and SRFI 33 names. They have been incorporated into this SRFI.
R6RS
is a subset of SRFI 60, except that all procedure names begin with a
bitwise-
prefix. A few procedures have been added from the general vector
SRFI 133
Among the applications of bitwise operations are: hashing, Galois-field calculations of error-detecting and error-correcting codes, cryptography and ciphers, pseudo-random number generation, register-transfer-level modeling of digital logic designs, Fast-Fourier transforms, packing and unpacking numbers in persistent data structures, space-filling curves with applications to dimension reduction and sparse multi-dimensional database indexes, and generating approximate seed values for root-finders and transcendental function algorithms.
This SRFI differs from SRFI 142 in only two ways:
The
bitwise-if
function has the argument ordering of SLIB, SRFI 60, and R6RS rather than the ordering of SRFI 33.
The order in which bits are processed by the procedures listed in the "Bits conversion" section has been clarified and some of the procedures' names have been changed. See "Bit processing order" for details.
150
Hygienic ERR5RS Record Syntax (reduced)
, by Marc Nieper-Wißkirchen
Final:
2018-01-16
Keywords:
Data Structure
Record Type
See also
SRFI 9: Defining Record Types
SRFI 99: ERR5RS Records
SRFI 131: ERR5RS Record Syntax (reduced)
SRFI 136: Extensible record types
, and
SRFI 237: R6RS Records (refined)
This SRFI provides a specification and portable implementation of an extension of the ERR5RS record syntax of
SRFI 131
, where field names inserted by macro transformers are effectively renamed as if the macro transformer inserted a binding. This makes this SRFI compatible with the semantics of the record-type definitions of the
R7RS
as intended by its
authors
. In addition, field names may also be other types of Scheme datums, like numbers and strings, or
SRFI 88
keyword objects.
149
Basic Syntax-rules Template Extensions
, by Marc Nieper-Wißkirchen
Final:
2017-07-08
Keywords:
Syntax
The rules for valid
s of
are slightly softened to allow for more than one consecutive
in subtemplates, and to allow pattern variables in subtemplates to be followed by more instances of the identifier
than they are followed in the subpattern in which they occur.
148
Eager syntax-rules
, by Marc Nieper-Wißkirchen
Final:
2017-08-08
Keywords:
Syntax
Writing powerful
syntax-rules
macros is hard because they do not compose well: The arguments of a macro expansion are not expanded. This SRFI defines an easy to comprehend high-level system for writing powerful, composable (or
eager
) macros, two of whose defining features are that its macro arguments are (in general) eagerly expanded and that it can be portably implemented in any Scheme implementation conforming to the R7RS.
147
Custom macro transformers
, by Marc Nieper-Wißkirchen
Final:
2017-03-07
Keywords:
Syntax
Each syntax definition assigns a macro transformer to a keyword. The macro transformer is specified by a transformer spec, which is either an instance of
syntax-rules
, an existing syntactic keyword (including macro keywords and the syntactic keywords that introduce the core forms, like
lambda
if
, or
define
), or a use of a macro that eventually expands into an instance of
syntax-rules
. In the latter case, the keyword of macro use is called a
custom macro transformer
146
Mappings
, by Arthur A. Gleckler and Marc Nieper-Wißkirchen
Final:
2018-05-24
Keywords:
Data Structure
R7RS Large
R7RS Large: Tangerine Edition
See also
SRFI 224: Integer Mappings
Mappings
are finite sets of associations, where each association is a pair consisting of a key and an arbitrary Scheme value. The keys are elements of a suitable domain. Each mapping holds no more than one association with the same key. The fundamental mapping operation is retrieving the value of an association stored in the mapping when the key is given.
145
Assumptions
, by Marc Nieper-Wißkirchen
Final:
2017-03-31
Keywords:
Optimization
Library name: assume
A means to denote the invalidity of certain code paths in a Scheme program is proposed. It allows Scheme code to turn the evaluation into a user-defined error that need not be signalled by the implementation. Optimizing compilers may use these denotations to produce better code and to issue better warnings about dead code.
144
Flonums
, by John Cowan and Will Clinger
Final:
2017-07-17
Keywords:
Numbers
R7RS Large
R7RS Large: Tangerine Edition
This SRFI describes numeric procedures applicable to
flonums
, a subset of the inexact real numbers provided by a Scheme implementation. In most Schemes, the flonums and the inexact reals are the same. These procedures are semantically equivalent to the corresponding generic procedures, but allow more efficient implementations.
143
Fixnums
, by John Cowan
Final:
2017-05-27
Keywords:
Numbers
R7RS Large
R7RS Large: Tangerine Edition
Library name: fixnums
This SRFI describes arithmetic procedures applicable to a limited range of exact integers only. These procedures are semantically similar to the corresponding generic-arithmetic procedures, but allow more efficient implementations.
142
Bitwise Operations
, by John Cowan
Withdrawn:
2017-08-10
Keywords:
Data Structure
Superseded
See also
SRFI 151: Bitwise Operations
This SRFI proposes a coherent and comprehensive set of procedures for performing bitwise logical operations on integers; it is accompanied by a reference implementation of the spec in terms of a set of seven core operators. The sample implementation is portable, as efficient as practical with pure Scheme arithmetic (it is worthwhile replacing the core operators with C or assembly language if possible), and open source.
The precise semantics of these operators is almost never an issue. A consistent, portable set of
names
and
parameter conventions
, however, is. Hence this SRFI, which is based mainly on
SRFI 33
, with some changes and additions from
Olin's late revisions to SRFI 33
(which were never consummated).
SRFI 60
(based on SLIB) is smaller but has a few procedures of its own; some of its procedures have both native (often Common Lisp) and SRFI 33 names. They have been incorporated into this SRFI.
R6RS
is a subset of SRFI 60, except that all procedure names begin with a
bitwise-
prefix. A few procedures have been added from the general vector
SRFI 133
Among the applications of bitwise operations are: hashing, Galois-field calculations of error-detecting and error-correcting codes, cryptography and ciphers, pseudo-random number generation, register-transfer-level modeling of digital logic designs, Fast-Fourier transforms, packing and unpacking numbers in persistent data structures, space-filling curves with applications to dimension reduction and sparse multi-dimensional database indexes, and generating approximate seed values for root-finders and transcendental function algorithms.
141
Integer division
, by Taylor Campbell and John Cowan
Final:
2016-12-14
Keywords:
Numbers
R7RS Large
R7RS Large: Tangerine Edition
Library name: integer-division
This SRFI provides a fairly complete set of integral division and remainder operators.
140
Immutable Strings
, by Per Bothner
Final:
2017-05-24
Keywords:
Data Structure
Text
See also
SRFI 118: Simple adjustable-size strings
and
SRFI 135: Immutable Texts
This attempts to solve the same issues with R7RS strings raised by
SRFI-135
, but with better integration with the Scheme language.
We propose to retain the name
string
as the type of sequences of Unicode characters (scalar values). There are two standard subtypes of string:
Immutable strings, also called
istrings
, cannot be modified after they have been created. Calling
string-set!
on an istring throws an error. On the other hand, the core operations
string-ref
and
string-length
are guaranteed to be O(1).
Mutable strings can be modified
in-place
using
string-set!
and other operations. However,
string-ref
string-set!
, or
string-length
have no performance guarantees. On many implementation they may take time proportional to the length of the string.
An implementation may support other kinds of strings. For example on the Java platform it may be reasonable to consider any instance of
java.lang.CharSequence
to be a string.
The main part of the proposal specifies the default bindings of various procedure names, as might be pre-defined in a REPL. Specifically, some procedures that traditionally return mutable strings are changed to return istrings. We later discuss compatibility and other library issues.
This combines
SRFI-13
SRFI-135
, and
SRFI-118
139
Syntax parameters
, by Marc Nieper-Wißkirchen
Final:
2016-10-02
Keywords:
Binding
Parameters
See also
SRFI 211: Scheme Macro Libraries
Syntax parameters are to the expansion process of a Scheme program what parameters are to the evaluation process of a Scheme program. They allow hygienic implementation of syntactic forms that would otherwise introduce implicit identifiers unhygienically.
138
Compiling Scheme programs to executables
, by Marc Nieper-Wißkirchen
Final:
2016-09-28
Keywords:
Operating System
This SRFI describes, for sufficiently POSIX-compatible systems, a portable interface for compiling Scheme programs conforming to the R7RS to binaries that can be directly executed on the host system.
137
Minimal Unique Types
, by John Cowan and Marc Nieper-Wißkirchen
Final:
2016-10-04
Keywords:
Data Structure
Record Type
This SRFI is intended to standardize a primitive run-time mechanism to create disjoint types.
136
Extensible record types
, by Marc Nieper-Wißkirchen
Final:
2016-12-25
Keywords:
Data Structure
Record Type
See also
SRFI 237: R6RS Records (refined)
SRFI 9 and the compatible R7RS-small provide Scheme with record types. The basic problem that is solved by these record types is that they allow the user to introduce new types, disjoint from all existing types. The record type system described in this document is a conservative extension to SRFI 9 and R7RS record types (in other words, the keyword
define-record-type
defined in this specification can serve as the equally named keyword from SRFI 9 and R7RS and can thus be safely exported from
(srfi 9)
and
(scheme base)
) that is intended to solve another fundamental problem, namely the introduction of subtypes.
135
Immutable Texts
, by William D Clinger
Final:
2016-09-06
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Text
See also
SRFI 118: Simple adjustable-size strings
SRFI 130: Cursor-based string library
SRFI 140: Immutable Strings
, and
SRFI 152: String Library (reduced)
In Scheme, strings are a mutable data type. Although it "is an error" (
R5RS
and
R7RS
) to use
string-set!
on literal strings or on strings returned by
symbol->string
, and any attempt to do so "should raise an exception" (
R6RS
), all other strings are mutable.
Although many mutable strings are never actually mutated, the mere possibility of mutation complicates specifications of libraries that use strings, encourages precautionary copying of strings, and precludes structure sharing that could otherwise be used to make procedures such as
substring
and
string-append
faster and more space-efficient.
This
SRFI
specifies a new data type of immutable texts. It comes with efficient and portable sample implementations that guarantee O(1) indexing for both sequential and random access, even in systems whose
string-ref
procedure takes linear time.
The operations of this new data type include analogues for all of the non-mutating operations on strings specified by the R7RS and most of those specified by
SRFI 130
, but the immutability of texts and uniformity of character-based indexing simplify the specification of those operations while avoiding several inefficiencies associated with the mutability of Scheme's strings.
134
Immutable Deques
, by Kevin Wortman, John Cowan, and Wolfgang Corcoran-Mathe
Final:
2016-07-01
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
This SRFI defines immutable deques. A deque is a double-ended queue, a sequence which allows elements to be added or removed efficiently from either end. A structure is immutable when all its operations leave the structure unchanged. Note that none of the procedures specified here ends with an exclamation point.
133
Vector Library (R7RS-compatible)
, by John Cowan
Based on SRFI 43 by Taylor Campbell.
Final:
2016-03-20
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: vectors
See also
SRFI 43: Vector library
and
SRFI 160: Homogeneous numeric vector libraries
This SRFI proposes a comprehensive library of vector operations accompanied by a freely available and complete reference implementation. The reference implementation is unencumbered by copyright, and useable with no modifications on any Scheme system that is R5RS-compliant. It also provides several hooks for implementation-specific optimization as well.
132
Sort Libraries
, by John Cowan
Based on SRFI 32 by Olin Shivers.
Final:
2016-04-20
Keywords:
Algorithm
R7RS Large
R7RS Large: Red Edition
Library name: sorting
See also
SRFI 32: Sort Libraries
This SRFI describes the API for a full-featured sort toolkit.
131
ERR5RS Record Syntax (reduced)
, by John Cowan and Will Clinger
Final:
2016-02-13
Keywords:
Data Structure
Record Type
Library name: records
See also
SRFI 150: Hygienic ERR5RS Record Syntax (reduced)
This SRFI is a reduced version of the SRFI 99 syntactic layer that can be implemented with
syntax-rules
without requiring low-level macros. Like SRFI-99's syntax layer, it is backward compatible with the
define-record-type
macro from
SRFI 9
or R7RS-small. It is forward compatible with
SRFI 99
130
Cursor-based string library
, by John Cowan
Final:
2016-05-28
Keywords:
Data Structure
Text
Library name: string-cursors
See also
SRFI 13: String Libraries
R5RS
Scheme has an impoverished set of string-processing utilities, which is a problem for authors of portable code. Although
R7RS
provides some extensions and improvements, it is still very incomplete. This
SRFI
proposes a coherent and comprehensive set of string-processing procedures; it is accompanied by a portable sample implementation of the spec.
This SRFI is derived from SRFI 13. The biggest difference is that it allows subsequences of strings to be specified by
cursors
as well as the traditional string indexes. In addition, it omits the comparison, case-mapping, and mutation operations of SRFI 13, as well as all procedures already present in
R7RS
129
Titlecase procedures
, by John Cowan
Final:
2016-03-08
Keywords:
Internationalization
Text
Library name: titlecase
This SRFI defines R7RS-style
char-title-case?
char-titlecase
, and
string-titlecase
procedures.
128
Comparators (reduced)
, by John Cowan
Final:
2016-02-14
Keywords:
Comparison
Library name: comparators
See also
SRFI 114: Comparators
and
SRFI 162: Comparators sublibrary
This SRFI provides
comparators
, which bundle a type test predicate, an equality predicate, an ordering predicate, and a hash function (the last two are optional) into a single Scheme object. By packaging these procedures together, they can be treated as a single item for use in the implementation of data structures.
127
Lazy Sequences
, by John Cowan
Final:
2016-01-18
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: lazy-sequences
Lazy sequences (or lseqs, pronounced "ell-seeks") are a generalization of lists. In particular, an lseq is either a proper list or a dotted list whose last cdr is a
SRFI 121
generator. A generator is a procedure that can be invoked with no arguments in order to lazily supply additional elements of the lseq. When a generator has no more elements to return, it returns an end-of-file object. Consequently, lazy sequences cannot reliably contain end-of-file objects.
This SRFI provides a set of procedures suitable for operating on lazy sequences based on
SRFI 1
126
R6RS-based hashtables
, by Taylan Ulrich Bayırlı/Kammer
Final:
2016-02-01
Keywords:
Data Structure
Library name: r6rs-hashtables
See also
SRFI 69: Basic hash tables
and
SRFI 125: Intermediate hash tables
We provide a hashtable API that takes the R6RS hashtables API as a basis and makes backwards compatible additions such as support for weak hashtables, external representation, API support for double hashing implementations, and utility procedures.
125
Intermediate hash tables
, by John Cowan and Will Clinger
Final:
2016-05-28
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: hashtables
See also
SRFI 69: Basic hash tables
and
SRFI 126: R6RS-based hashtables
This SRFI defines an interface to hash tables, which are widely recognized as a fundamental data structure for a wide variety of applications. A hash table is a data structure that:
Is disjoint from all other types.
Provides a mapping from objects known as
keys
to corresponding objects known as
values
Keys may be any Scheme objects in some kinds of hash tables, but are restricted in other kinds.
Values may be any Scheme objects.
Has no intrinsic order for the key-value
associations
it contains.
Provides an
equality predicate
which defines when a proposed key is the same as an existing key. No table may contain more than one value for a given key.
Provides a
hash function
which maps a candidate key into a non-negative exact integer.
Supports mutation as the primary means of setting the contents of a table.
Provides key lookup and destructive update in (expected) amortized constant time, provided a satisfactory hash function is available.
Does not guarantee that whole-table operations work in the presence of concurrent mutation of the whole hash table (values may be safely mutated).
124
Ephemerons
, by John Cowan
Final:
2015-11-06
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
See also
SRFI 254: Ephemerons and Guardians
An ephemeron is an object with two components called its
key
and its
datum
. It differs from an ordinary pair as follows: if the garbage collector (GC) can prove that there are no references to the key except from the ephemeron itself and possibly from the datum, then it is free to
break
the ephemeron, dropping its reference to both key and datum. In other words, an ephemeron can be broken when nobody else cares about its key. Ephemerons can be used to construct weak vectors or lists and (possibly in combination with finalizers) weak hash tables.
Much of this specification is derived with thanks from the MIT Scheme Reference Manual.
123
Generic accessor and modifier operators
, by Taylan Ulrich Bayırlı/Kammer
Final:
2015-10-14
Keywords:
Miscellaneous
Lisp dialects including Scheme have traditionally lacked short, simple, generic syntax for accessing and modifying the fields of arbitrary "collection" objects. We fill this gap for Scheme by defining generalized accessors, and an associated SRFI-17 setter.
122
Nonempty Intervals and Generalized Arrays
, by Bradley J. Lucier
Withdrawn:
2022-09-25
Keywords:
Data Structure
Numbers
Superseded
See also
SRFI 164: Enhanced multi-dimensional Arrays
SRFI 179: Nonempty Intervals and Generalized Arrays (Updated)
, and
SRFI 231: Intervals and Generalized Arrays
This SRFI specifies an array mechanism for Scheme. Arrays as defined here are quite general; at their most basic, an array is simply a mapping, or function, from multi-indices of exact integers $i_0,\ldots,i_{d-1}$ to Scheme values. The set of multi-indices $i_0,\ldots,i_{d-1}$ that are valid for a given array form the
domain
of the array. In this SRFI, each array's domain consists of a rectangular interval $[l_0,u_0)\times[l_1,u_1)\times\cdots\times[l_{d-1},u_{d-1})$, a subset of $\mathbb Z^d$, $d$-tuples of integers. Thus, we introduce a data type called
intervals
, which encapsulate the cross product of nonempty intervals of exact integers. Specialized variants of arrays are specified to provide portable programs with efficient representations for common use cases.
121
Generators
, by Shiro Kawai, John Cowan, and Thomas Gilray
Withdrawn:
2019-07-18
Keywords:
Data Structure
R7RS Large: Red Edition
Superseded
See also
SRFI 158: Generators and Accumulators
This SRFI defines utility procedures that create, transform, and consume generators. A generator is simply a procedure with no arguments that works as a source of a series of values. Every time it is called, it yields a value. Generators may be finite or infinite; a finite generator returns an end-of-file object to indicate that it is exhausted. For example,
read-char
read-line
, and
read
are generators that generate characters, lines, and objects from the current input port. Generators provide lightweight laziness.
120
Timer APIs
, by Takashi Kato
Final:
2015-08-06
Keywords:
Miscellaneous
This SRFI defines interfaces to handle timer processes.
119
wisp: simpler indentation-sensitive scheme
, by Arne Babenhauserheide
Final:
2015-06-23
Keywords:
Reader Syntax
This SRFI describes a simple syntax which allows making scheme easier to read for newcomers while keeping the simplicity, generality and elegance of s-expressions. Similar to
SRFI 110
SRFI 49
and Python it uses indentation to group expressions. Like
SRFI 110
wisp is general and homoiconic.
Different from its predecessors, wisp only uses the absolute minimum of additional syntax-elements which are required for writing and exchanging arbitrary code-structures. As syntax elements it only uses a colon surrounded by whitespace, the period followed by whitespace as first code-character on the line and optional underscores followed by whitespace at the beginning of the line.
It resolves a limitation of
SRFI 110
and
SRFI 49
, both of which force the programmer to use a single argument per line if the arguments to a procedure need to be continued after a procedure-call.
Wisp expressions can include arbitrary s-expressions and as such provide backwards compatibility.
wisp
s-exp
define
factorial
n __
if
zero?
n ____ . 1 ____
n :
factorial
(- n 1)
display
factorial
newline
define
factorial
n) (
if
zero?
n) 1 (
n (
factorial
(- n 1))))) (
display
factorial
5)) (
newline
118
Simple adjustable-size strings
, by Per Bothner
Final:
2015-07-07
Keywords:
Data Structure
Text
See also
SRFI 135: Immutable Texts
and
SRFI 140: Immutable Strings
Scheme specifies mutable fixed-length strings. We add two procedures
string-append!
and
string-replace!
which allow the size of the string to change. We also require that the standard Scheme procedures
make-string
and
string-copy
return variable-size strings.
117
Queues based on lists
, by John Cowan
Final:
2015-08-25
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: list-queues
List queues are mutable ordered collections that can contain any Scheme object. Each list queue is based on an ordinary Scheme list containing the elements of the list queue by maintaining pointers to the first and last pairs of the list. It's cheap to add or remove elements from the front of the list or to add elements to the back, but not to remove elements from the back. List queues are disjoint from other types of Scheme objects.
116
Immutable List Library
, by John Cowan
Final:
2014-11-28
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Scheme currently does not provide immutable pairs corresponding to its existing mutable pairs, although most uses of pairs do not exploit their mutability. The
Racket
system takes the radical approach of making Scheme's pairs immutable, and providing a minimal library of mutable pairs with procedures named
mpair?, mcons, mcar, mcdr, set-mcar!, set-mcdr!
. This SRFI takes the opposite approach of leaving Scheme's pairs unchanged and providing a full set of routines for creating and dealing with immutable pairs. The sample implementation is portable (to systems with SRFI 9) and efficient.
115
Scheme Regular Expressions
, by Alex Shinn
Final:
2014-07-14
Keywords:
Data Structure
R7RS Large
R7RS Large: Tangerine Edition
Text
Library name: regexp
See also
SRFI 264: String Syntax for Scheme Regular Expressions
This SRFI provides a library for matching strings with regular expressions described using the SRE "Scheme Regular Expression" notation first introduced by SCSH, and extended heavily by IrRegex.
114
Comparators
, by John Cowan
Withdrawn:
2017-08-10
Keywords:
Comparison
Superseded
See also
SRFI 128: Comparators (reduced)
This proposal is a rewrite of
SRFI 67
, Compare Procedures, extending it from procedures that represent a total order to procedure bundles that represent one or more of a total order, an equality predicate, and a hash function. By packaging these procedures together, along with a type test predicate, they can be treated as a single item for use in the implementation of data structures.
113
Sets and bags
, by John Cowan
Final:
2014-11-28
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
See also
SRFI 217: Integer Sets
Sets
and
bags
(also known as multisets) are unordered collections that can contain any Scheme object. Sets enforce the constraint that no two elements can be the same in the sense of the set's associated
equality predicate
; bags do not.
112
Environment Inquiry
, by John Cowan
Final:
2013-09-12
Keywords:
Operating System
This is a proposal for environment inquiry, providing human-readable information
at run time
about the hardware and software configuration on which a Scheme program is being executed. They are mostly based on Common Lisp, with additions from the Posix
uname()
system call.
111
Boxes
, by John Cowan
Final:
2013-07-03
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
See also
SRFI 195: Multiple-value boxes
Boxes are objects with a single mutable state. Several Schemes have them, sometimes called
cells
. A constructor, predicate, accessor, and mutator are provided.
110
Sweet-expressions (t-expressions)
, by David A. Wheeler and Alan Manuel K. Gloria
Final:
2013-09-09
Keywords:
Reader Syntax
This SRFI describes a set of syntax extensions for Scheme, called sweet-expressions (t-expressions), that has the same descriptive power as s-expressions but is designed to be easier for humans to read. The sweet-expression syntax enables the use of syntactically-meaningful indentation to group expressions (similar to Python), and it builds on the infix and traditional function notation defined in
SRFI-105 (curly-infix-expressions)
. Unlike nearly all past efforts to improve s-expression readability, sweet-expressions are general (the notation is independent from any underlying semantic) and homoiconic (the underlying data structure is clear from the syntax). This notation was developed by the “
Readable Lisp S-expressions Project
” and can be used for both programs and data.
Sweet-expressions can be considered a set of additional abbreviations, just as
'x
already abbreviates
(quote x)
. Sweet-expressions and traditionally formatted s-expressions can be freely mixed; this provides backwards compatibility, simplifies transition, and enables developers to maximize readability. Here is an example of a sweet-expression and its equivalent s-expression (note that a sweet-expression reader would accept
either
format):
sweet-expression
s-expression
define fibfast(n) ; Typical function notation if {n < 2} ; Indentation, infix {...} n ; Single expr = no new list fibup n 2 1 0 ; Simple function calls
(define (fibfast n) (if (< n 2) n (fibup n 2 1 0)))
109
Extended string quasi-literals
, by Per Bothner
Final:
2013-06-21
Keywords:
Reader Syntax
Text
See also
SRFI 107: XML reader syntax
and
SRFI 108: Named quasi-literal constructors
This specifies a reader extension for extended string quasi-literals, including nicer multi-line strings, and enclosed unquoted expressions.
This proposal is related to
SRFI-108 (named quasi-literal constructors)
and
SRFI-107 (XML reader syntax)
, as they share quite a bit of syntax.
108
Named quasi-literal constructors
, by Per Bothner
Final:
2013-06-21
Keywords:
Reader Syntax
This specifies an extensible reader syntax for named value constructors. A reader prefix is followed by a
tag
(an identifier), and then expressions and literal text parameters. The tag can be though of as a class name, and the expression and literal text are arguments to an object constructor call. The reader translates
tag
{...}
to a list
($construct$:
tag
...)
, where
$construct$:
tag
is normally bound to a predefined macro.
This propsal depends on
SRFI-109 (extended string quasi-literals)
(in spite of having a lower number). It also shares quite of bit of syntax with
SRFI-107 (XML reader syntax)
107
XML reader syntax
, by Per Bothner
Final:
2013-12-22
Keywords:
Reader Syntax
We specify a reader extension that reads data in a superset of XML/HTML format, and produces conventional S-expressions. We also suggest a possible semantics interpretation of how these forms may be evaluated to produce XML-node values, but this is non-normative.
106
Basic socket interface
, by Takashi Kato
Final:
2013-08-20
Keywords:
I/O
This document specifies basic socket interfaces.
105
Curly-infix-expressions
, by David A. Wheeler and Alan Manuel K. Gloria
Final:
2012-11-06
Keywords:
Reader Syntax
See also
SRFI 266: The expr syntax
Lisp-based languages, like Scheme, are almost the only programming languages in modern use that do not support infix notation. In addition, most languages allow infix expressions to be combined with function call notation of the form
. This SRFI provides these capabilities, both for developers who already use Scheme and want these conveniences, and also for other developers who may choose to use other languages in part because they miss these conveniences. Scheme currently reserves
...
“for possible future extensions to the language”. We propose that
...
be used to support “curly-infix-expression” notation as a homoiconic infix abbreviation, as a modification of the Scheme reader. It is an abbreviation in much the same way that
'x
is an abbreviation for
(quote x)
curly-infix list
introduces a list whose visual presentation can be in infix order instead of prefix order. For example,
{n > 5}
(> n 5)
, and
{a + b + c}
(+ a b c)
. By intent, there is no precedence, but e.g.,
{x + {y * z}}
maps cleanly to
(+ x (* y z))
. Forms with mixed infix operators and other complications have “
$nfx$
” prepended to enable later processing, e.g.,
{4 + 5 * 6}
($nfx$ 4 + 5 * 6)
. Also, inside a curly-infix list (recursively), expressions of the form
...
are simply an abbreviation for
...
Note that this is derived from the “
readable
” project. We intend to later submit at least one additional SRFI that will build on top of this SRFI, but curly-infix-expressions are useful on their own.
104
Library Files Utilities
, by Derick Eddington
Withdrawn:
2010-05-23
Keywords:
Operating System
This SRFI implements
SRFI 103: Library Files
as a library. It is useful for working with library files.
103
Library Files
, by Derick Eddington
Withdrawn:
2013-05-08
Keywords:
Operating System
This SRFI defines a standard for locating files containing libraries with list-of-symbols library names, for unixes and Windows. It defines a standard for files containing R6RS libraries. It supports different Scheme dialects.
102
Procedure Arity Inspection
, by David Van Horn
Withdrawn:
2013-02-24
Keywords:
Introspection
Many Scheme systems provide mechanisms for inspecting the arity of a procedural value, making it a common feature, however there is no standard interface. As a result there is no portable way to observe the arity of a procedure
without actually applying it
. This SRFI proposes a simple interface that is consistent with existing Scheme systems' facilities and prior proposals.
101
Purely Functional Random-Access Pairs and Lists
, by David Van Horn
Final:
2013-02-24
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Random-access lists [1] are a purely functional data structure for representing lists of values. A random-access list may act as a drop in replacement for the usual linear-access pair and list data structures (
pair?
cons
car
cdr
), which additionally supports fast index-based addressing and updating (
list-ref
list-set
). The impact is a whole class of purely-functional algorithms expressed in terms of index-based list addressing become feasible compared with their linear-access list counterparts.
This document proposes a library API for purely functional random-access lists consistent with the R
RS [2] base library and list utility standard library [3].
100
define-lambda-object
, by Joo ChurlSoo
Final:
2010-06-21
Keywords:
Data Structure
Record Type
This SRFI introduces a macro, DEFINE-LAMBDA-OBJECT which defines a set of procedures, that is, a group, two constructors, and a predicate. The constructors also make a group of procedures, namely lambda objects. The macro extends DEFINE-RECORD-TYPE (SRFI 9) in being more general but much less general than DEFCLASS (CLOS). The macro has no explicit field accessors and mutators but parent groups, required fields, optional fields, automatic fields, read-write fields, read-only fields, inaccessible hidden fields, immutable virtual fields, and common sharing fields.
99
ERR5RS Records
, by William D Clinger
Final:
2009-10-07
Keywords:
Data Structure
Record Type
Library name: records
See also
SRFI 237: R6RS Records (refined)
and
SRFI 256: Minimal extension to SRFI 9/R7RS small record type definitions for inheritance
Many Scheme programmers have considered records to be one of the most important features missing from the R5RS. The R6RS proposed a record system, but its design has been widely criticized and it was not intended for use in R5RS programs anyway.
This SRFI proposes a better record system for use in R5RS, ERR5RS, and R6RS programs. The syntactic layer of this SRFI's record system is an extension of SRFI 9. The procedural and inspection layers of this SRFI's record system are perfectly compatible with its syntactic layer. This entire SRFI is compatible with the procedural and inspection layers of the R6RS record system, but offers several worthwhile improvements over the R6RS system.
98
An interface to access environment variables
, by Taro Minowa (Higepon)
Final:
2008-09-19
Keywords:
Operating System
Library name: os-environment-variables
This SRFI specifies the procedure get-environment-variable, which gets the value of the specified environment variable, and the procedure get-environment-variables, which gets an association list of all environment variables.
97
SRFI Libraries
, by David Van Horn
Final:
2008-12-22
Keywords:
Modules
See also
SRFI 261: Portable SRFI Library Reference
Over the past ten years, numerous libraries have been specified via the Scheme Requests for Implementation process. Yet until the recent ratification of the Revised
Report on the Algorithmic Language Scheme, there has been no standardized way of distributing or relying upon library code. Now that such a library system exists, there is a real need to organize these existing SRFI libraries so that they can be portably referenced.
This SRFI is designed to facilitate the writing and distribution of code that relies on SRFI libraries. It identifies a subset of existing SRFIs that specify features amenable to provision (and possibly implementation) as libraries (SRFI Libraries) and proposes a naming convention for this subset so that these libraries may be referred to by name or by number.
96
SLIB Prerequisites
, by Aubrey Jaffer
Final:
2008-07-07
Keywords:
Features
This SRFI specifies a set of procedures and macros presenting a uniform interface sufficient to host the
SLIB Scheme Library
system.
95
Sorting and Merging
, by Aubrey Jaffer
Final:
2007-01-29
Keywords:
Algorithm
Library name: sorting-and-merging
Sorting and Merging are useful operations deserving a common API.
94
Type-Restricted Numerical Functions
, by Aubrey Jaffer
Final:
2007-01-30
Keywords:
Numbers
In the coding of numerial calculations in latent-typed languages it is good practice to assure that those calculations are using the intended number system. The most common number systems for programmatic calculations are the integers, reals, and complexes. This SRFI introduces 14 real-only and 3 integer-only variants of R5RS procedures to facilitate numerical type checking and declaration.
93
R6RS Syntax-Case Macros
, by Kent Dybvig
Withdrawn:
2006-08-23
Keywords:
Syntax
R6RS process
See also
SRFI 188: Splicing binding constructs for syntactic keywords
and
SRFI 211: Scheme Macro Libraries
The syntactic abstraction system described here extends the R5RS macro system with support for writing low-level macros in a high-level style, with automatic syntax checking, input destructuring, output restructuring, maintenance of lexical scoping and referential transparency (hygiene), and support for controlled identifier capture, with constant expansion overhead. Because it does not require literals, including quoted lists or vectors, to be copied or even traversed, it preserves sharing and cycles within and among the constants of a program. It also supports source-object correlation, i.e., the maintenance of ties between the original source code and expanded output, allowing implementations to provide source-level support for debuggers and other tools.
92
ALAMBDA and ALAMBDA*
, by Joo ChurlSoo
Withdrawn:
2007-04-09
Keywords:
Miscellaneous
Type Checking
This SRFI introduces ALAMBDA and ALAMBDA*, each of which has two modes of operation:
it creates a procedure that checks actual arguments and takes optional arguments,
it returns a different procedure by checking each of actual arguments and the number of them.
91
Extended ports
, by Marc Feeley
Withdrawn:
2007-07-10
Keywords:
I/O
This SRFI specifies an extension to the R5RS ports that supports several useful features: binary I/O and text I/O, bulk I/O, file opening attributes, and bidirectional ports. Binary I/O is provided through byte ports which are ports whose fundamental I/O unit is an 8 bit byte. Because characters can be encoded with bytes using a character encoding such as ISO 8859-1, UTF-8, and UTF-16BE, any byte port is also a character port (a port that supports the character level I/O of R5RS). A byte port's character encoding and various other attributes are specified when the port is opened. Because reasonable defaults exist, these attributes are specified using a named optional parameter syntax. All procedures which have the same name as in R5RS are compatible with R5RS but may provide additional functionality.
90
Extensible hash table constructor
, by Marc Feeley
Final:
2007-07-10
Keywords:
Data Structure
This SRFI specifies the procedure
make-table
, a hash table constructor compatible with
SRFI 69 (Basic hash tables)
. The procedure
make-table
allows various parameters of the hash table to be specified with optional named parameters when it is constructed. These parameters are: the initial size, the minimum and maximum load factor, the key equivalence function, the key hashing function, whether the references to the keys are weak, and similarly for the values. By using optional named parameters, as specified in
SRFI 89 (Optional positional and named parameters)
, the constructor's API can be easily extended in a backward compatible way by other SRFIs and Scheme implementations.
89
Optional positional and named parameters
, by Marc Feeley
Final:
2007-07-10
Keywords:
Binding
See also
SRFI 88: Keyword objects
and
SRFI 177: Portable keyword arguments
This SRFI specifies the
define*
and
lambda*
special forms. These forms extend the R5RS
define
and
lambda
special forms to simplify the use of optional positional and named parameters. Optional positional parameters, optional named parameters and required named parameters are covered by this SRFI. The formal parameter list syntax specified in this SRFI is different from the syntax used by Common Lisp and the DSSSL languages but nevertheless offers similar functionality and a nicer syntax. Formal parameter lists which conform to the R5RS syntax have the same meaning as in R5RS.
88
Keyword objects
, by Marc Feeley
Final:
2007-07-03
Keywords:
Reader Syntax
See also
SRFI 89: Optional positional and named parameters
and
SRFI 177: Portable keyword arguments
This SRFI defines
keyword
objects, a data type similar to Scheme symbols. Keyword objects have the same lexical syntax as symbols but they must end in a colon. Moreover keyword objects are self-evaluating. Procedures for converting between strings and keyword objects (
string->keyword
and
keyword->string
) and a type predicate (
keyword?
) are defined. Finally this SRFI specifies the changes to the Scheme lexical syntax required to accomodate keywords.
87
=> in case clauses
, by Chongkai Zhu
Final:
2006-10-18
Keywords:
Control Flow
Library name: case
This SRFI proposes an extension to the
case
syntax to allow the
=>
clauses as in
cond
86
MU and NU simulating VALUES & CALL-WITH-VALUES, and their related LET-syntax
, by Joo ChurlSoo
Final:
2006-06-20
Keywords:
Data Structure
Multiple-Value Returns
Library name: mu-and-nu
Unlike the
values
call-with-values
mechanism of R5RS, this SRFI uses an explicit representation for multiple return values as a single value, namely a procedure. Decomposition of multiple values is done by simple application. Each of the two macros,
mu
and
nu
, evaluates to a procedure that takes one procedure argument. The
mu
and
nu
can be compared with
lambda
. While
lambda
expression that consists of
lambda
expression is called,
mu
and
nu
expressions that consist of
lambda
require
lambda
expression, later when the evaluated
mu
and
nu
expressions are called.
This SRFI also introduces new
let
-syntax depending on
mu
and
nu
to manipulate multiple values,
alet
and
alet*
that are compatible with
let
and
let*
of R5RS in single value bindings. They also have a binding form making use of
values
and
call-with-values
to handle multiple values. In addition, they have several new binding forms for useful functions such as escape, recursion, etc.
85
Recursive Equivalence Predicates
, by William D Clinger
Withdrawn:
2006-10-21
Keywords:
Comparison
This SRFI defines two related equivalence predicates that are recursive, not just partial recursive: they terminate on all arguments. One of these predicates,
equiv?
, is consistent with the
equal?
procedure described in the R5RS: Whenever
equal?
terminates,
equiv?
returns the same value as
equal?
84
Universal Identifiers
, by Andrew Wilcox
Withdrawn:
2006-11-09
Keywords:
Data Structure
This SRFI proposes a social convention to allow programmers to easily create short, simple Scheme symbols which are guaranteed to be universally unique: No other programmer also following this SRFI will accidentally create a symbol eq? to yours.
Universally unique symbols are useful to identify standards, languages, libraries, types, classes, and other resources.
83
R6RS Library Syntax
, by Matthew Flatt and Kent Dybvig
Withdrawn:
2006-09-13
Keywords:
Modules
R6RS process
The module system presented here is designed to let programmers share libraries, i.e., code that is intended to be incorporated into larger programs, and especially into programs that use library code from multiple sources. The module system supports macro definitions within modules, allows macro exports, and distinguishes the phases in which definitions and imports are needed. This SRFI defines a standard notation for libraries, a semantics for library expansion and execution, and a simple format for sharing libraries.
82
Stream Ports
, by Michael Sperber
Withdrawn:
2006-11-20
Keywords:
I/O
This SRFI augments
SRFI 81 (Port I/O)
by allowing ports to be constructed from streams as described in
SRFI 80 (Stream I/O)
81
Port I/O
, by Michael Sperber
Withdrawn:
2006-11-20
Keywords:
I/O
See also
SRFI 80: Stream I/O
and
SRFI 186: Transcoders and transcoded ports
This SRFI defines an I/O layer similar in nature to the ports subsystem in R5RS, and provides conventional, imperative buffered input and output.
The layer architecture is similar to the upper three layers of the I/O subsystem in
The Standard ML Basis Library
In particular, the subsystem fulfills the following requirements:
buffered reading and writing
binary and text I/O, mixed if needed
the ability to create arbitrary I/O ports from readers and writers
It builds on the Primitive I/O layer specified in
SRFI 79 (Primitive I/O)
80
Stream I/O
, by Michael Sperber
Withdrawn:
2006-11-20
Keywords:
I/O
See also
SRFI 81: Port I/O
and
SRFI 186: Transcoders and transcoded ports
This SRFI defines an I/O layer for lazy, mostly functional buffered streams.
The layer architecture is similar to the upper three layers of the I/O subsystem in
The Standard ML Basis Library
In particular, this layer provides
buffered reading and writing
arbitrary lookahead
dynamic redirection of input or output
binary and text I/O, mixed if needed
translated data streams
the ability to create I/O streams from arbitrary readers and writers
It builds on the Primitive I/O layer specified in
SRFI 79 (Primitive I/O)
79
Primitive I/O
, by Michael Sperber
Withdrawn:
2006-11-16
Keywords:
I/O
See also
SRFI 181: Custom ports (including transcoded ports)
This SRFI defines a simple, primitive I/O subsystem for Scheme that is intended to function as the lowest layer of a more comprehensive suite of I/O layers. It provides unbuffered I/O, and is close to what a typical operating system offers. Thus, its interface is suitable for implementing high-throughput and zero-copy I/O.
The Primitive I/O layer also allows clients to implement custom data sources and sinks via a simple interface.
Moreover, this SRFI defines a condition hierarchy specifying common I/O-related exceptional situations.
The Primitive I/O layer only handles blocking-I/O. Non-blocking and selective I/O is left for another SRFI.
This I/O layer was designed in conjunction with two other layers that can be built on top of it:
SRFI 80 (Stream I/O)
and
SRFI 81 (Port I/O)
78
Lightweight testing
, by Sebastian Egner
Final:
2006-03-06
Keywords:
Testing
Library name: lightweight-testing
A simple mechanism is defined for testing Scheme programs. As a most primitive example, the expression
(check (+ 1 1) => 3)
evaluates the expression
(+ 1 1)
and compares the result with the expected result 3 provided after the syntactic keyword
=>
. Then the outcome of this comparison is reported in human-readable form by printing a message of the form
(+ 1 1) => 2 ; *** failed *** ; expected result: 3
Moreover, the outcome of any executed check is recorded in a global state counting the number of correct and failed checks and storing the first failed check. At the end of a file, or at any other point, the user can print a summary using
check-report
In addition to the simple test above, it is also possible to execute a parametric sequence of checks. Syntactically, this takes the form of an eager comprehension in the sense of
SRFI 42
[5]. For example,
(check-ec (:range e 100) (:let x (expt 2.0 e)) (= (+ x 1) x) => #f (e x))
This statement runs the variable
through {0..99} and for each binding defines
as
(expt 2.0 e)
. Then it is checked if
(+ x 1)
is equal to
, and it is expected that this is not the case (i.e. expected value is
#f
). The trailing
(e x)
tells the reporting mechanism to print the values of both
and
in case of a failed check. The output could look like this:
(let ((e 53) (x 9007199254740992.0)) (= (+ x 1) x)) => #t ; *** failed *** ; expected result: #f
The specification of bindings to report,
(e x)
in the example, is optional but very informative. Other features of this SRFI are:
A way to specify a different equality predicate (default is
equal?
).
Controlling the amount of reporting being printed.
Switching off the execution and reporting of checks entriely.
Retrieving a boolean if all checks have been executed and passed.
77
Preliminary Proposal for R6RS Arithmetic
, by William D Clinger and Michael Sperber
Withdrawn:
2006-09-13
Keywords:
R6RS process
Numbers
Scheme's arithmetic system was designed to allow a wide variety of implementations. After many years of implementation experience, however, most implementations now fall into a small number of categories, and the benefits of continued experimentation no longer justify the confusion and portability problems that have resulted from giving implementations so much freedom in this area. Moreover, the R5RS generic arithmetic is difficult to implement as efficiently as purely fixnum or purely flonum arithmetic. (Fixnum arithmetic is typically limited-precision integer arithmetic implemented using one or more representations that may be especially efficient on the executing machine; flonum arithmetic is typically limited-precision floating-point arithmetic using one or more representations that may be especially efficient on the executing machine.)
This SRFI is an effort to extend and clarify the R5RS arithmetic to make it more portable, more comprehensive, and enable faster programs.
Furthermore, one of us (Sperber) has argued that Scheme's arithmetic requires radical overhaul. The other (Clinger) agrees that revisions are needed. Whether these revisions qualify as radical is best left to the judgement of individual readers.
This SRFI proposes to revise section 6.2 ("Numbers") of R5RS by:
requiring a Scheme implementation to provide the full tower, including exact rationals of arbitrary precision, exact rectangular complex numbers with rational real and imaginary parts, and inexact real and complex arithmetic
defining fixnum arithmetic (parameterized by precision)
defining flonum arithmetic (inexactly)
defining new procedures for performing exact arithmetic
defining new procedures for performing inexact arithmetic
describing the external representation and semantics of 0.0, -0.0, infinities and NaNs for systems that implement inexact real arithmetic using IEEE binary floating point
changing the specification of
eqv?
to behave more sensibly with inexact numbers
defining Scheme's real numbers to be the complex numbers whose imaginary part is an exact zero
adding an external representation for inexact numbers that expresses the precision of a binary floating point representation
defining procedures for some new operations, including integer division and remainder on real numbers, and bitwise operations,
restricting the domains of some R5RS procedures
clarifying the semantics of some R5RS procedures
possibly changing the semantics of some R5RS procedures
76
R6RS Records
, by Will Clinger, R. Kent Dybvig, Michael Sperber, and Anton van Straaten
Withdrawn:
2006-04-24
Keywords:
Data Structure
Record Type
R6RS process
This SRFI describes abstractions for creating new data types representing records - data structures with named fields. This SRFI comes in four parts:
a procedural layer for creating and manipulating record types and record instances
an explicit-naming syntactic layer for defining the various entities associated with a record type - construction procedure, predicate, field accessors, mutators, etc. - at once
an implicit-naming syntactic layer built on top of the explicit-naming syntactic layer, which chooses the names for the various products based on the names of the record type and fields
a set of reflection procedures
75
R6RS Unicode data
, by Matthew Flatt and Marc Feeley
Withdrawn:
2006-05-27
Keywords:
Internationalization
R6RS process
Text
Unicode is a widespread universal character code that supports most of the world's (natural) languages. The extensions to Scheme specified in this SRFI concern the support of Unicode in Scheme's character, string, and symbol datatypes. This SRFI does not (fully) specify how I/O of Unicode data is performed or how Scheme source code is encoded in files; these aspects are left for other SRFIs to specify.
74
Octet-Addressed Binary Blocks
, by Michael Sperber
Final:
2005-12-15
Keywords:
Data Structure
Library name: blobs
This SRFI defines a set of procedures for creating, accessing, and manipulating octet-addressed blocks of binary data, in short,
blobs
. The SRFI provides access primitives for fixed-length integers of arbitrary size, with specified endianness, and a choice of unsigned and two's complement representations.
73
Exact Infinities
, by Chongkai Zhu
Withdrawn:
2005-11-30
Keywords:
Numbers
Many Scheme implementations support exact arbitrary-precision integer arithmetic as well as exact rational number computation. This SRFI extends the rational numbers of R5RS by adding two rational infinities (1/0, -1/0).
With infinities added to the number system we find that division by zero "works". It lets initialization of variables precede bounds checks and gives flexibility in placement of those checks.
72
Hygienic macros
, by André van Tonder
Final:
2005-09-21
Keywords:
Syntax
This SRFI describes a procedural macro proposal for Scheme with the following features:
Improved hygiene:
We argue that conventional hygiene algorithms may lead to accidental variable capture errors in procedural macros. We propose an improved algorithm that avoids these problems.
Reflective tower:
We specify a reflective tower of arbitrary height, and propose a refinement of lexical scoping that takes into account the phase of use of an identifier in determining its meaning.
Syntax-case:
In the current proposal, the
syntax-case
form is expressible as a macro in terms of a simpler set of primitives and is specified as library syntax.
Procedural interface:
The primitive interface for manipulating compound syntax objects consists of procedures rather than special forms. In particular, the traditional abstractions
car
cdr
cons
...
can be used on syntactic data.
Fast hygiene algorithm:
The reference implementation documents a fast imperative hygiene algorithm that is eager and linear in expression size.
Capturing identifiers:
A primitive
make-capturing-identifier
is provided for intentional variable capture and for building expansion-time fluid binding constructs.
71
Extended LET-syntax for multiple values
, by Sebastian Egner
Final:
2005-08-12
Keywords:
Binding
Multiple-Value Returns
Library name: let
See also
SRFI 8: receive: Binding to multiple values
SRFI 11: Syntax for receiving multiple values
, and
SRFI 210: Procedures and Syntax for Multiple Values
This SRFI is a proposal for extending
let
let*
, and
letrec
for receiving multiple values. The syntactic extension is fully compatible with the existing syntax. It is the intention that single-value bindings, i.e.
(let ((var expr)) ...)
, and multiple-value binding can be mixed freely and conveniently.
The most simple form of the new syntax is best explained by an example:
(define (quo-rem x y) (values (quotient x y) (remainder x y))) (define (quo x y) (let ((q r (quo-rem x y))) q))
The procedure
quo-rem
delivers two values to its continuation. These values are received as
and
in the
let
-expression of the procedure
quo
. In other words, the syntax of
let
is extended such that several variables can be specified---and these variables receive the values delivered by the expression
(quo-rem x y)
The syntax of
let
is further extended to cases in which a rest argument receives the list of all residual values. Again by example,
(let (((values y1 y2 . y3+) (foo x))) body)
In this example,
values
is a syntactic keyword indicating the presence of multiple values to be received, and
y1
y2
, and
y3+
, resp., are variables bound to the first value, the second value, and the list of the remaining values, resp., as produced by
(foo x)
. The syntactic keyword
values
allows receiving all values as in
(let (((values . xs) (foo x))) body)
. It also allows receiving no values at all as in
(let (((values) (for-each foo list))) body)
A common application of binding multiple values is decomposing data structures into their components. This mechanism is illustrated in its most primitive form as follows: The procedure
uncons
(defined below) decomposes a pair
into its car and its cdr and delivers them as two values to its continuation. Then an extended
let
can receive these values:
(let ((car-x cdr-x (uncons x))) (foo car-x cdr-x))
Of course, for pairs this method is probably neither faster nor clearer than using the procedures
car
and
cdr
. However, for data structures doing substantial work upon decomposition this is different: Extracting the element of highest priority from a priority queue, while at the same time constructing the residual queue, can both be more efficient and more convenient than doing both operations independently. In fact, the
quo-rem
example illustrates this point already as both quotient and remainder are probably computed by a common exact division algorithm. (And often caching is used to avoid executing this algorithm twice as often as needed.)
As the last feature of this SRFI, a mechanism is specified to store multiple values in heap-allocated data structures. For this purpose,
values->list
and
values->vector
construct a list (a vector, resp.) storing all values delivered by evaluating their argument expression. Note that these operations cannot be procedures.
70
Numbers
, by Aubrey Jaffer
Final:
2005-09-11
Keywords:
Data Structure
Numbers
This SRFI proposes text to replace section 6.2 "Numbers" of R5RS in order to extend its capabilities, correct errors in its specification, make it more explicit about limitations of precision and magnitude, and improve portability between implementations. More specifically, this new text:
incorporates an inexact real positive infinity and an inexact real negative infinity,
extends number syntax to incorporate inexact real infinities,
adapts Common-Lisp semantics for
`expt'
and extends them to include inexact real infinities,
corrects the description of
`sqrt'
sharpens the distinction between exact and inexact numbers,
removes a contradiction related to exactness,
extends
`gcd'
and
`lcm'
to exact rational numbers,
extends
`quotient'
`modulo'
, and
`remainder'
to finite real numbers,
clarifies the behavior of
`inexact->exact'
applied to an exact argument,
clarifies the behavior of
`exact->inexact'
applied to an inexact argument,
adds convenience procedures
`exact-round'
`exact-ceiling'
`exact-floor'
, and
`exact-truncate'
and adds examples.
69
Basic hash tables
, by Panu Kalliokoski
Final:
2005-09-14
Keywords:
Data Structure
Library name: basic-hash-tables
See also
SRFI 125: Intermediate hash tables
and
SRFI 126: R6RS-based hashtables
This SRFI defines basic hash tables. Hash tables are widely recognised as a fundamental data structure for a wide variety of applications. A hash table is a data structure that:
provides a mapping from some set of keys to some set of values associated to those keys
has no intrinsic order for the (key, value) associations it contains
supports in-place modification as the primary means of setting the contents of a hash table
provides key lookup and destructive update in amortised constant time, provided that a good hash function is used.
This SRFI aims to accomplish these goals:
to provide a consistent, generic and widely applicable API for hash tables
to improve code portability by providing a standard hash table facility with guaranteed behaviour
to help the programmer by defining utility routines that account for the most common situations of using hash tables.
68
Comprehensive I/O
, by Michael Sperber
Withdrawn:
2005-11-29
Keywords:
I/O
This SRFI defines a comprehensive I/O subsystem for Scheme with three layers, where each layer is built on top of the one below it:
The lowest, primitive layer provides unbuffered I/O, and is close to what a typical operating system offers.
The middle layer builds on lazy, mostly functional buffered streams.
The upper layer is similar in nature to the ports subsystem in R5RS, and provides conventional, imperative buffered input and output.
The layer architecture is similar to the upper three layers of the I/O subsystem in
The Standard ML Basis Library
In particular, the subsystem provides
buffered reading and writing
arbitrary lookahead at the streams level
dynamic redirection of input or output at the ports level
binary and text I/O, mixed if needed
translated data streams
unbuffered I/O at the primitive layer
the ability to create arbitrary I/O streams, such as to and from blobs and strings
The subsystem does
not
provide
formatted I/O
non-blocking or selective I/O
portable filenames, or any functionality for manipulating filenames
filesystem operations
socket I/O
extremely high-throughput or zero-copy I/O
However, all of these could be added on top of one or several of the layers specified in this SRFI.
67
Compare Procedures
, by Sebastian Egner and Jens Axel Søgaard
Final:
2005-09-11
Keywords:
Comparison
Library name: compare-procedures
This SRFI can be seen as an extension of the standard procedures
char
etc. of R
RS -- or even as a replacement. The primary design aspect in this SRFI is the separation of
representing
a total order and
using it.
For representing the order, we have chosen for truly 3-way comparisons. For using it we provide an extensive set of operations, each of which accepts a procedure used for comparison. Since these compare procedures are often optional, comparing built-in types is as convenient as R
RS , sometimes more convenient: For example, testing if the integer index
lies in the integer range {0,
...
1} can be written as
(<=/ 0 i n)
, implicitly invoking
default-compare
As soon as new total orders are required, the infrastructure provided by this SRFI is far more convenient and often even more efficient than building each total order from scratch.
Moreover, in case Scheme users and implementors find this mechanism useful and adopt it, the benefit of having a uniform interface to total orders to be used in data structures will manifest itself. Most concretely, a new sorting procedure in the spirit of this SRFI would have the interface
(my-sort [
compare
xs
, using
default-compare
if the optional
compare
was not provided. Then
my-sort
could be defined using the entire infrastructure of this SRFI: Efficient 2- and 3-way branching, testing for chains and pairwise inequality, min/max, and general order statistics.
66
Octet Vectors
, by Michael Sperber
Final:
2005-12-15
Keywords:
Data Structure
Library name: octet-vectors
This SRFI defines a set of procedures for creating, accessing, and manipulating uniform vectors of octets.
65
define-immutable: A Syntax to Define Identifiers With Immutable Values
, by Andrew Wilcox
Withdrawn:
2005-05-17
Keywords:
Binding
Lazy Evaluation
The
define-immutable
form defines an identifier whose value never changes.
The expression part of the definition is evaluated lazily: it is not evaluated unless and until the identifier is evaluated. This permits an immutable definition to use other definitions in more ways than is possible when using
define
in internal definitions.
A series of immutable definitions have simple semantics, making them easy to program and understand.
(let () (define-immutable x (+ z 5)) (define-immutable y (/ 100 4)) (define-immutable z (add-10 y)) (define-immutable add-10 (add-n 10)) (define-immutable (add-n n) (lambda (x) (+ n x))) x) => 40
64
A Scheme API for test suites
, by Per Bothner
Final:
2006-06-18
Keywords:
Testing
Library name: testing
See also
SRFI 252: Property Testing
and
SRFI 269: Portable Test Definitions
This defines an API for writing
test suites
, to make it easy to portably test Scheme APIs, libraries, applications, and implementations. A test suite is a collection of
test cases
that execute in the context of a
test-runner
. This specifications also supports writing new test-runners, to allow customization of reporting and processing the result of running test suites.
63
Homogeneous and Heterogeneous Arrays
, by Aubrey Jaffer
Final:
2005-04-27
Keywords:
Data Structure
Numbers
Library name: arrays
The SRFI, which is to supersede
SRFI-47
, "Array",
synthesizes array concepts from Common-Lisp and Alan Bawden's "array.scm";
incorporates all the uniform vector types from
SFRI-4
"Homogeneous numeric vector datatypes";
adds a boolean uniform array type;
adds 16.bit and 128.bit floating-point uniform-array types;
adds decimal floating-point uniform-array types; and
adds array types of (dual) floating-point complex numbers.
Multi-dimensional arrays subsume homogeneous vectors as the one-dimensional case, obviating the need for SRFI-4.
SRFI-58 gives a read/write invariant syntax for the homogeneous and heterogeneous arrays described here.
62
S-expression comments
, by Taylor Campbell
Final:
2005-07-21
Keywords:
Reader Syntax
This SRFI proposes a simple extension to Scheme's lexical syntax that allows individual S-expressions to be made into comments, ignored by the reader. This contrasts with the standard Lisp semicolon comments, which make the reader ignore the remainder of the line, and the slightly less common block comments, as
SRFI 30
defines: both of these mechanisms comment out slices of text, not S-expressions.
61
A more general cond clause
, by Taylor Campbell
Final:
2005-07-21
Keywords:
Binding
Control Flow
Library name: cond
This SRFI proposes an extension to the
cond
syntax to allow a more general clause, one that allows binding the results of tests as in the
=>
clauses and user-defined meaning of the success & failure of tests.
60
Integers as Bits
, by Aubrey Jaffer
Final:
2005-03-08
Keywords:
Data Structure
Numbers
Library name: integer-bits
Treating integers as two's-complement strings of bits is an arcane but important domain of computer science. It is used for:
hashing;
Galois-field[2] calculations of error-detecting and error-correcting codes;
cryptography and ciphers;
pseudo-random number generation;
register-transfer-level modeling of digital logic designs;
Fast-Fourier transforms;
packing and unpacking numbers in persistant data structures;
space-filling curves with applications to dimension reduction and sparse multi-dimensional database indexes; and
generating approximate seed values for root-finders and transcendental function algorithms.
59
Vicinity
, by Aubrey Jaffer
Final:
2005-03-08
Keywords:
I/O
Library name: vicinities
A vicinity is a descriptor for a place in the file system. Vicinities hide from the programmer the concepts of host, volume, directory, and version. Vicinities express only the concept of a file environment where a file name can be resolved to a file in a system independent manner.
All of these procedures are file-system dependent. Use of these vicinity procedures can make programs file-system
in
dependent.
58
Array Notation
, by Aubrey Jaffer
Final:
2005-03-08
Keywords:
Reader Syntax
SRFI-47
and its successor
SRFI-63
provide both homogeneous numeric and heterogeneous multidimensional arrays which subsume Scheme vectors. The notation presented here builds upon Common-Lisp array syntax to represent heterogeneous arrays; and introduces a new Scheme-based notation for denoting homogeneous numeric arrays.
57
Records
, by André van Tonder
Final:
2005-03-07
Keywords:
Data Structure
Record Type
Library name: records
We describe a syntax for defining record types. A predicate, constructor, and field accessors and modifiers may be specified for each record type. We also introduce a syntax for declaring record type schemes, representing families of record types that share a set of field labels. A polymorphic predicate and polymorphic field accessors and modifiers may be specified for each record type scheme. A syntax is provided for constructing records by field label, for in-place and for functional record update, and for composing records.
56
Binary I/O
, by Alex Shinn
Withdrawn:
2005-10-31
Keywords:
I/O
This SRFI extends Scheme with procedures to read and write binary data to and from ports, including utility procedures for writing various integer and floating point values in both big and little endian formats. Predicates are provided to test if binary I/O is allowed on a port, along with new procedures for creating such ports.
55
require-extension
, by Felix L. Winkelmann and D.C. Frost
Final:
2004-11-05
Keywords:
Features
This SRFI specifies an extremely simple facility for making an extension or library available to a Scheme toplevel environment.
54
Formatting
, by Joo ChurlSoo
Final:
2004-06-24
Keywords:
I/O
Library name: cat
This SRFI introduces the CAT procedure that converts any object to a string. It takes one object as the first argument and accepts a variable number of optional arguments, unlike the procedure called FORMAT.
53
Syntactic computations with computation-rules
, by André van Tonder
Withdrawn:
2004-09-06
Keywords:
Syntax
This SRFI provides a portable framework for writing complex high-level macros that perform nontrivial computations during expansion.
52
Permitting and Supporting Extended Character Sets
, by Thomas Lord
Withdrawn:
2004-06-17
Keywords:
Data Structure
This SRFI describes how to modify the
Revised Report
R5RS
) in order to enable conforming implementations to use an extended character set such as (but not limited to)
Unicode
Changes to some requirements of the report are recommended. Currently, the
Revised Report
contains requirements which are difficult or impossible to satisfy with some extended character sets.
New required procedures are proposed, specified, and included in the reference implementation. These procedures enable portable Scheme programs to manipulate Scheme source texts and source data accurately, even in implementations using extended character sets.
This SRFI concludes with some suggestions for implementors interested in providing good Unicode support, using these suggestions to illustrate how the proposed changes to the
Revised Report
can "play out" in Unicode-based Scheme.
This SRFI does
not
attempt to provide a comprehensive library for global text processing. For example, one issue in global text processing is the need for linguistically-sensitive, locale-sensitive procedures for sorting strings. Such procedures are beyond the scope of this SRFI. On the other hand, by making Scheme compatible with extended character sets, this SRFI is a step in the direction of permitting global text processing standard libraries to be developed in a form portable across all conforming implementations.
This SRFI does
not
propose that implementations be required to support Unicode or any other extended character set. It does not specify a representation for Unicode characters or strings. It
does
revise the specifications of the report so that
char?
values
may be
Unicode (or other) characters.
The reference implementation included should prove to be easily ported to and effective for all ASCII-only implementations and for many implementations using an 8-bit character set which is an extension of ASCII (it will require very minor modifications for each particular implementation). Other implementations may need to use a different implementation.
51
Handling rest list
, by Joo ChurlSoo
Final:
2004-06-07
Keywords:
Multiple-Value Returns
Library name: rest-values
This SRFI introduces the
rest-values
procedure which has three modes of operation:
it processes a rest list after checking its elements with default values or predicate procedures,
it processes a rest list with default values without checking its elements,
it processes a default list whose elements are lists or pairs, after checking their elements that are default values or predicate procedures with the elements of a rest list,
and eight macros which additionally check the rest arguments that are returned by
rest-values
50
Mixing Scheme and C
, by Richard Kelsey and Michael Sperber
Withdrawn:
2005-12-20
Keywords:
Operating System
This SRFI describes an interface for calling C functions from Scheme, calling Scheme functions from C, and allocating storage in the Scheme heap. Scheme manages stub functions in C that negotiate between the calling conventions of Scheme and C and the memory allocation policies of both worlds.
The following facilities are available for interfacing between Scheme and C:
Scheme code can call C functions.
The external interface provides full introspection for all Scheme objects. External code may inspect, modify, and allocate Scheme objects arbitrarily.
External code may signal errors to the Scheme system.
External code may call back into Scheme. Scheme correctly unrolls the process stack on non-local exits.
External modules may register bindings of names to values with a central registry accessible from Scheme. Conversely, Scheme code can register shared bindings for access by C code.
The interface is closely based on that of
Scheme 48
and
scsh
49
Indentation-sensitive syntax
, by Egil Möller
Final:
2005-07-22
Keywords:
Reader Syntax
This SRFI descibes a new syntax for Scheme, called I-expressions, whith equal descriptive power as S-expressions. The syntax uses indentation to group expressions, and has no special cases for semantic constructs of the language. It can be used both for program and data input.
It also allows mixing S-expressions and I-expressions freely, giving the programmer the ability to layout the code as to maximize readability.
48
Intermediate Format Strings
, by Ken Dickey
Final:
2004-03-02
Keywords:
I/O
Text
Library name: intermediate-format-strings
See also
SRFI 28: Basic Format Strings
and
SRFI 159: Combinator Formatting
This document specifies Format Strings, a method of interpreting a Scheme string which contains a number of format directives that are replaced with other string data according to the semantics of each directive. This SRFI extends
SRFI-28
in being more generally useful but is less general than advanced format strings in that it does not allow, aside from ~F, for controlled positioning of text within fields.
47
Array
, by Aubrey Jaffer
Final:
2004-06-14
Keywords:
Data Structure
Library name: arrays
"slib/array.scm" synthesizes array ideas from Common-Lisp and Alan Bawden with homogeneous vector ideas from
SRFI-4
and
SCM
. The result portably integrates homogeneous and heterogeneous arrays into Scheme.
46
Basic Syntax-rules Extensions
, by Taylor Campbell
Final:
2005-02-28
Keywords:
Syntax
Library name: syntax-rules
See also
SRFI 211: Scheme Macro Libraries
This SRFI proposes two extensions to the R5RS
syntax-rules
pattern language: the first allows
syntax-rules
macros to generate macros, where the macro-generated macros use ellipsis that is not used by the macro-generating macros; the second allows for 'tail patterns.'
45
Primitives for Expressing Iterative Lazy Algorithms
, by André van Tonder
Final:
2004-04-05
Keywords:
Data Structure
Library name: lazy
See also
SRFI 155: Promises
Lazy evaluation is traditionally simulated in Scheme using
delay
and
force
. However, these primitives are not powerful enough to express a large class of lazy algorithms that are iterative. Indeed, it is folklore in the Scheme community that typical iterative lazy algorithms written using
delay
and
force
will often require unbounded memory.
Although varous modifications of
delay
and
force
had been proposed to resolve this problem (see e.g., the SRFI-40 discussion list) they all fail some of the benchmarks provided below. To our knowledge, the current SRFI provides the first exhaustive solution to this problem.
As motivation, we first explain how the usual laziness encoding using only
delay
and
force
will break the iterative behavior of typical algorithms that would have been properly tail-recursive in a true lazy language, causing the computation to require unbounded memory.
The problem is then resolved by introducing a set of three operations:
lazy
delay
force
which allow the programmer to succinctly express lazy algorithms while retaining bounded space behavior in cases that are properly tail-recursive. A general recipe for using these primitives is provided. An additional procedure
{eager}
is provided for the construction of eager promises in cases where efficiency is a concern.
Although this SRFI redefines
delay
and
force
, the extension is conservative in the sense that the semantics of the subset {
delay
force
} in isolation (i.e., as long as the program does not use
lazy
) agrees with that in R5RS. In other words, no program that uses the R5RS definitions of delay and force will break if those definition are replaced by the SRFI-45 definitions of delay and force.
44
Collections
, by Scott G. Miller
Final:
2004-03-07
Keywords:
Data Structure
Library name: collections
A Collections API which defines a common naming scheme and set of operations for creating, accessing, and manipulating common datastructures in Scheme. The API defines accessors, a common protocol for value access via generic and specific enumeration, and functions for inter-datastructure cooperation. Finally, a concrete specification of a compliant set of operators for the standard Scheme heterogenous datastructures (lists and vectors) and for the homogeneous Scheme string is provided.
43
Vector library
, by Taylor Campbell
Final:
2004-10-26
Keywords:
Data Structure
Library name: vectors
See also
SRFI 133: Vector Library (R7RS-compatible)
This SRFI proposes a comprehensive and complete library of vector operations accompanied by a freely available and complete reference implementation. The reference implementation is unencumbered by copyright, and useable with no modifications on any Scheme system that is R5RS-compliant. It also provides several hooks for implementation-specific optimization as well.
Because this SRFI is more of a library or module specification than a request for additions to readers or any other internal implementation detail, in an implementation that supports a module or structure or package or library or unit (et cetera) systems, these procedures should be contained in a module / structure / package / library / unit called
vector-lib
42
Eager Comprehensions
, by Sebastian Egner
Final:
2003-07-07
Keywords:
Control Flow
Library name: eager-comprehensions
See also
SRFI 196: Range Objects
This SRFI defines a modular and portable mechanism for eager comprehensions extending the algorithmic language Scheme [R5RS]. An eager comprehension is a convenient notation for one or more nested or parallel loops generating a sequence of values, and accumulating this sequence into a result.
41
Streams
, by Philip L. Bewig
Final:
2008-01-24
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: streams
See also
SRFI 40: A Library of Streams
Streams, sometimes called lazy lists, are a sequential data structure containing elements computed only on demand. A stream is either null or is a pair with a stream in its cdr. Since elements of a stream are computed only when accessed, streams can be infinite. Once computed, the value of a stream element is cached in case it is needed again.
Streams without memoization were first described by Peter Landin in 1965. Memoization became accepted as an essential feature of streams about a decade later. Today, streams are the signature data type of functional programming languages such as Haskell.
This Scheme Request for Implementation describes two libraries for operating on streams: a canonical set of stream primitives and a set of procedures and syntax derived from those primitives that permits convenient expression of stream operations. They rely on facilities provided by R6RS, including libraries, records, and error reporting. To load both stream libraries, say:
(import (streams))
40
A Library of Streams
, by Philip L. Bewig
Withdrawn:
2017-08-10
Keywords:
Data Structure
Superseded
See also
SRFI 41: Streams
Along with higher-order functions, one of the hallmarks of functional programming is lazy evaluation. A primary manifestation of lazy evaluation is lazy lists, generally called streams by Scheme programmers, where evaluation of a list element is delayed until its value is needed.
The literature on lazy evaluation distinguishes two styles of laziness, called even and odd. Odd style streams are ubiquitous among Scheme programs and can be easily encoded with the Scheme primitives delay and force defined in R5RS. However, the even style delays evaluation in a manner closer to that of traditional lazy languages such as Haskell and avoids an "off by one" error that is symptomatic of the odd style.
This SRFI defines the stream data type in the even style, some essential procedures and syntax that operate on streams, and motivates our choice of the even style. A companion SRFI 41 Stream Library provides additional procedures and syntax which make for more convenient processing of streams and shows several examples of their use.
39
Parameter objects
, by Marc Feeley
Final:
2003-06-30
Keywords:
Binding
Parameters
Library name: parameters
This SRFI defines
parameter
objects, the procedure
make-parameter
to create parameter objects and the
parameterize
special form to dynamically bind parameter objects. In the dynamic environment, each parameter object is bound to a cell containing the value of the parameter. When a procedure is called the called procedure inherits the dynamic environment from the caller. The
parameterize
special form allows the binding of a parameter object to be changed for the dynamic extent of its body.
38
External Representation for Data With Shared Structure
, by Ray Dillinger
Final:
2003-04-02
Keywords:
I/O
Library name: with-shared-structure
This SRFI proposes
(write-with-shared-structure)
and
(read-with-shared-structure)
, procedures for writing and reading external representations of data containing shared structure. These procedures implement a proposed standard external notation for data containing shared structure.
This SRFI permits but does not require replacing the standard
(write)
and
(read)
functions. These functions may be implemented without the overhead in time and space required to detect and specify shared structure.
An implementation conforms to this SRFI if it provides procedures named
(write-with-shared-structure)
and
(read-with-shared-structure)
, which produce and read the same notation as produced by the reference implementation. It may also provide
(read/ss)
and
(write/ss)
, equivalent functions with shorter names.
37
args-fold: a program argument processor
, by Anthony Carrico
Final:
2003-01-13
Keywords:
Operating System
Library name: args-fold
Many operating systems make the set of argument strings used to invoke a program available (often following the program name string in an array called argv). Most programs need to parse and process these argument strings in one way or another. This SRFI describes a set of procedures that support processing program arguments according to POSIX and GNU C Library Reference Manual guidelines.
36
I/O Conditions
, by Michael Sperber
Final:
2002-12-01
Keywords:
Exceptions
I/O
This SRFI specifies a set of condition types for I/O errors. The condition types are defined in terms of
SRFI 35
. Moreover, this SRFI requires a Scheme system implementing it to raise exceptions in the sense of
SRFI 34
for errors occurring during the execution of the R5RS
I/O operations
35
Conditions
, by Richard Kelsey and Michael Sperber
Final:
2002-12-01
Keywords:
Exceptions
Library name: conditions
The SRFI defines constructs for creating and inspecting
condition
types and values. A condition value encapsulates information about an exceptional situation, or exception. This SRFI also defines a few basic condition types.
34
Exception Handling for Programs
, by Richard Kelsey and Michael Sperber
Final:
2002-12-01
Keywords:
Exceptions
Library name: exception-handling
This SRFI defines exception-handling and exception-raising constructs for Scheme, including
with-exception-handler
procedure and a
guard
form for installing exception-handling procedures,
raise
procedure for invoking the current exception handler.
This SRFI is based on (withdrawn)
SRFI 12: Exception Handling
by William Clinger, R. Kent Dybvig, Matthew Flatt, and Marc Feeley.
33
Integer Bitwise-operation Library
, by Olin Shivers
Withdrawn:
2003-07-17
Keywords:
Data Structure
R5RS Scheme has no utilities for performing bitwise logical operations on integers or bitstrings, which is a problem for authors of portable code. This SRFI proposes a coherent and comprehensive set of these functions; it is accompanied by a reference implementation of the spec in terms of a set of seven core operators. The reference implementation is
portable
efficient
completely open, public-domain source
The precise semantics of these operators is almost never an issue. A consistent, portable set of
names
and
parameter conventions
, however, is. Hence this SRFI.
32
Sort Libraries
, by Olin Shivers
Withdrawn:
2003-07-17
Keywords:
Algorithm
Current Scheme sorting packages are, every one of them, surprisingly bad. I've designed the API for a full-featured sort toolkit, which I propose as an SRFI. The spec comes with 1200 lines of high-quality reference code: tightly written, highly commented, portable code, available for free. Implementors want this code. It's better than what you have.
31
A special form `rec' for recursive evaluation
, by Mirko Luedde
Final:
2002-12-02
Keywords:
Miscellaneous
Library name: rec
We propose the implementation of a special form called
rec
. This form is a generalization and combination of the forms
rec
and
named-lambda
of [Clinger1985]. It allows the simple and non-imperative construction of self-referential expressions. As an important special case, it extends the A. Church form
lambda
such that it allows the direct definition of recursive procedures without using further special forms like
let
or
letrec
, without using advanced constructions like the H. B. Curry combinator and, unlike
define
, without introducing variable bindings into the external environment.
30
Nested Multi-line Comments
, by Martin Gasbichler
Final:
2002-08-07
Keywords:
Reader Syntax
This SRFI extends R5RS by possibly nested, multi-line comments. Multi-line comments start with
#|
and end with
|#
29
Localization
, by Scott G. Miller
Final:
2002-08-01
Keywords:
I/O
Library name: localization
This document specifies an interface to retrieving and displaying locale sensitive messages. A Scheme program can register one or more translations of templated messages, and then write Scheme code that can transparently retrieve the appropriate message for the locale under which the Scheme system is running.
28
Basic Format Strings
, by Scott G. Miller
Final:
2002-06-25
Keywords:
I/O
Text
Library name: basic-format-strings
See also
SRFI 48: Intermediate Format Strings
and
SRFI 159: Combinator Formatting
This document specifies Format Strings, a method of interpreting a Scheme string which contains a number of escape sequences that are replaced with other string data according to the semantics of each sequence.
27
Sources of Random Bits
, by Sebastian Egner
Final:
2002-06-03
Keywords:
Randomness
Library name: random-bits
This document specifies an interface to sources of random bits, or "random sources" for brevity. In particular, there are three different ways to use the interface, with varying demands on the quality of the source and the amount of control over the production process:
The "no fuss" interface specifies that
(random-integer
produces the next random integer in {0, ...,
-1} and
(random-real)
produces the next random real number between zero and one. The details of how these random values are produced may not be very relevant, as long as they appear to be sufficiently random.
For simulation purposes, on the contrary, it is usually necessary to know that the numbers are produced deterministically by a pseudo random number generator of high quality and to have explicit access to its state. In addition, one might want to use several independent sources of random numbers at the same time and it can be useful to have some simple form of randomization.
For security applications a serious form of true randomization is essential, in the sense that it is difficult for an adversary to exploit or introduce imperfections into the distribution of random bits. Moreover, the linear complexity of the stream of random bits is more important than its statistical properties. In these applications, an entropy source (producing truely random bits at a low rate) is used to randomize a pseudo random number generator to increase the rate of available bits.
Once random sources provide the infrastructure to obtain random bits, these can be used to construct other random deviates. Most important are floating point numbers of various distributions and random discrete structures, such as permutations or graphs. As there is an essentially unlimited number of such objects (with limited use elsewhere), we do not include them in this SRFI. In other words, this SRFI is
not
about making all sorts of random objects---it is about obtaining random bits in a portable, flexible, reliable, and efficient way.
26
Notation for Specializing Parameters without Currying
, by Sebastian Egner
Final:
2002-02-14
Keywords:
Syntax
Library name: cut
See also
SRFI 156: Syntactic combiners for binary predicates
and
SRFI 232: Flexible curried procedures
When programming in functional style, it is frequently necessary to specialize some of the parameters of a multi-parameter procedure. For example, from the binary operation
cons
one might want to obtain the unary operation
(lambda (x) (cons 1 x))
. This specialization of parameters is also known as "partial application", "operator section" or "projection".
The mechanism proposed here allows to write this sort of specialization in a simple and compact way. The mechanism is best explained by a few examples:
(cut cons (+ a 1) <>)
is the same as
(lambda (x2) (cons (+ a 1) x2))
(cut list 1 <> 3 <> 5)
is the same as
(lambda (x2 x4) (list 1 x2 3 x4 5))
(cut list)
is the same as
(lambda () (list))
(cut list 1 <> 3 <...>)
is the same as
(lambda (x2 . xs) (apply list 1 x2 3 xs))
(cut <> a b)
is the same as
(lambda (f) (f a b))
As you see, the macro
cut
specializes some of the parameters of its first argument. The parameters that are to show up as formal variables of the result are indicated by the symbol
<>
, pronouced as "slot". In addition, the symbol
<...>
, pronounced as "rest-slot", matches all residual arguments of a variable argument procedure. As you can see from the last example above, the first argument can also be a slot, as one should expect in Scheme.
In addition to
cut
, there is a variant called
cute
(a mnemonic for "
cut
with evaluated non-slots") which evaluates the non-slot expressions at the time the procedure is specialized, not at the time the specialized procedure is called. For example,
(cute cons (+ a 1) <>)
is the same as
(let ((a1 (+ a 1))) (lambda (x2) (cons a1 x2)))
As you see from comparing this example with the first example above, the
cute
-variant will evaluate
(+ a 1)
once, while the
cut
-variant will evaluate it during every invokation of the resulting procedure.
The mechanism proposed in this SRFI allows specializing any subset of the variables of a procedure. The result can be of fixed arity or of variable arity. The mechanism does not allow permutation, omission, duplication or any other processing of the arguments; for this it is necessary to write to use a different mechanism such as
lambda
25
Multi-dimensional Array Primitives
, by Jussi Piitulainen
Final:
2002-05-21
Keywords:
Data Structure
Library name: multi-dimensional-arrays
A core set of procedures for creating and manipulating heterogeneous multidimensional arrays is proposed. The design is consistent with the rest of Scheme and independent of other container data types. It provides easy sharing of parts of an array as other arrays without copying, encouraging a declarative style of programming.
The specification is based on an original contribution by Alan Bawden in 1993.
24
Define-syntax in local lexical scopes
, by Antti Huima
Withdrawn:
2002-04-12
Keywords:
Syntax
This document specifies a proper extension to Scheme which allows
define-syntax
forms to appear in those places where local definitions can appear (R5RS, 5.2.2). A corresponding letrec-variant is described.
23
Error reporting mechanism
, by Stephan Houben
Final:
2001-06-22
Keywords:
Control Flow
Error Handling
Library name: error
A mechanism is proposed to allow Scheme code to report errors and abort execution. The proposed mechanism is already implemented in several Scheme systems and can be implemented, albeit imperfectly, in any R5RS conforming Scheme.
22
Running Scheme Scripts on Unix
, by Martin Gasbichler and Michael Sperber
Final:
2002-01-20
Keywords:
Operating System
This SRFI describes basic prerequisites for running Scheme programs as Unix scripts in a uniform way. Specifically, it describes:
the syntax of Unix scripts written in Scheme,
a uniform convention for calling the Scheme script interpreter, and
a method for accessing the Unix command line arguments from within the Scheme script.
21
Real-time multithreading support
, by Marc Feeley
Final:
2001-03-02
Keywords:
Concurrency
Library name: real-time-multithreading
This SRFI defines the following multithreading datatypes for Scheme
Thread
Mutex
Condition variable
Time
It also defines a mechanism to handle exceptions and some multithreading exception datatypes.
20
Simple object system
, by Christian Queinnec
Withdrawn:
2001-04-29
Keywords:
Object-Oriented Programming
Record Type
This SRFI presents an object system to define classes, generic functions as well as to support some level of introspection. This object system is based on Meroon-V3 which is itself inspired by CLOS.
Meroon-V3
is distributed and used since 1992.
19
Time Data Types and Procedures
, by Will Fitzgerald
Final:
2000-08-31
Keywords:
Data Structure
Library name: time
Points in time are represented as the number of seconds (with nanosecond precision) since "the epoch," a zero point in time. Several standard variants are defined, including UTC (universal coordinated time), TAI (international atomic time), and monotonic time. A point in time can also be represented as a Julian Day or Modified Julian Day number. Time durations, including time spent in a process or thread, are defined. Conversion routines are provided. The procedure CURRENT-TIME queries the current time in a specified variant, with a system-dependent resolution. Procedures for time arithmetic and time comparisons are also provided.
A date is a representation of a point in time in the Gregorian calendar, a 24 hour clock (with nanosecond precision) and a time zone offset from UTC. Procedures for converting between time and dates are provided, as well as for reading and writing string representations of dates.
18
Multithreading support
, by Marc Feeley
Final:
2001-03-14
Keywords:
Concurrency
Library name: multithreading
This SRFI defines the following multithreading datatypes for Scheme
Thread
Mutex
Condition variable
Time
It also defines a mechanism to handle exceptions and some multithreading exception datatypes.
17
Generalized set!
, by Per Bothner
Final:
2000-07-24
Keywords:
Assignment
Library name: generalized-set!
This is a proposal to allow procedure calls that evaluate to the "value of a location" to be used to
set
the value of the location, when used as the first operand of
set!
.For example:
(set! (car x) (car y))
becomes equivalent to
(set-car! x (car y))
Many programming languages have the concept of an
lvalue
. that is an "expression" that "evaluates" to a location, and which can appear on the left-hand-side of an assignment. Common Lisp has a related concept of "generalized variables" which can be used in
setf
and some other special forms. However, the Common Lisp concept is based on the idea of compile-time recognition of special "location-producing" functions; this does not seem to be in the "spirit of Scheme".
This SRFI proposes an extension of
set!
so that it provides similar functionality as Common Lisp's
setf
, except that the updater is associated with a procedure value, rather than a name.
16
Syntax for procedures of variable arity
, by Lars T Hansen
Final:
2000-03-10
Keywords:
Pattern Matching
Library name: case-lambda
CASE-LAMBDA, a syntax for procedures with a variable number of arguments, is introduced.
15
Syntax for dynamic scoping
, by Lars T Hansen
Withdrawn:
2000-03-10
Keywords:
Binding
Library name: fluid-let
FLUID-LET, a binding syntax for dynamic scoping, is introduced.
14
Character-set Library
, by Olin Shivers
Final:
2000-12-28
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Text
Library name: char-sets
The ability to efficiently represent and manipulate sets of characters is an unglamorous but very useful capability for text-processing code -- one that tends to pop up in the definitions of other libraries. Hence it is useful to specify a general substrate for this functionality early. This SRFI defines a general library that provides this functionality.
It is accompanied by a reference implementation for the spec. The reference implementation is fairly efficient, straightforwardly portable, and has a "free software" copyright. The implementation is tuned for "small" 7 or 8 bit character types, such as ASCII or Latin-1; the data structures and algorithms would have to be altered for larger 16 or 32 bit character types such as Unicode -- however, the specs have been carefully designed with these larger character types in mind.
Several forthcoming SRFIs can be defined in terms of this one:
string library
delimited input procedures (
e.g.
read-line
regular expressions
13
String Libraries
, by Olin Shivers
Final:
2000-12-28
Keywords:
Data Structure
Text
Library name: strings
See also
SRFI 130: Cursor-based string library
R5RS
Scheme has an impoverished set of string-processing utilities, which is a problem for authors of portable code. This
SRFI
proposes a coherent and comprehensive set of string-processing procedures; it is accompanied by a reference implementation of the spec. The reference implementation is
portable
efficient
open source
The routines in this SRFI are backwards-compatible with the string-processing routines of
R5RS
12
Exception Handling
, by William Clinger, R. Kent Dybvig, Matthew Flatt, and Marc Feeley
Withdrawn:
2000-01-22
Keywords:
Control Flow
Exceptions
The SRFI defines exception-handling constructs for Scheme, including
the CURRENT-EXCEPTION-HANDLER procedure for obtaining the current exception-handling procedure,
the WITH-EXCEPTION-HANDLER procedure and HANDLE-EXCEPTIONS form for installing an exception-handling procedure,
the ABORT and SIGNAL procedures for raising exceptions, and
constructs for creating and inspecting
condition
values, which encapsulate information about an exception.
This SRFI requires a Scheme implementation to raise an exception whenever an error is to be signaled or whenever the system determines that evaluation cannot proceed in a manner consistent with the semantics of Scheme. However, this SRFI does not define the information to be supplied by an implementation for each possible kind of exception; such a specification is left open for future SRFIs.
11
Syntax for receiving multiple values
, by Lars T Hansen
Final:
2000-03-15
Keywords:
Binding
Multiple-Value Returns
Library name: let-values
See also
SRFI 8: receive: Binding to multiple values
SRFI 71: Extended LET-syntax for multiple values
, and
SRFI 210: Procedures and Syntax for Multiple Values
The SRFI introduces syntactic forms LET-VALUES and LET*-VALUES that bind the values of expressions that return multiple values.
10
#, external form
, by Oleg Kiselyov
Final:
2000-01-13
Keywords:
Reader Syntax
The present SRFI proposes an extensible external representation of Scheme values, a notational convention for future SRFIs. This SRFI adds
#,(
as a new token and extends production rules of the grammar for a Scheme reader. The
#,()
form can be used for example to denote values that do not have a convenient printed representation, as well for conditional code compilation. It is proposed that future SRFIs that contain new read syntax for values use the
#,()
notation with an appropriate tag symbol.
As a particular example and the reference implementation for the
#,()
convention, this SRFI describes an interpretation of the
#,()
external form as a read-time application.
Defining Record Types
, by Richard Kelsey
Final:
1999-09-09
Keywords:
Data Structure
Record Type
Library name: records
See also
SRFI 99: ERR5RS Records
SRFI 237: R6RS Records (refined)
, and
SRFI 256: Minimal extension to SRFI 9/R7RS small record type definitions for inheritance
This SRFI describes syntax for creating new data types, called record types. A predicate, constructor, and field accessors and modifiers are defined for each record type. Each new record type is distinct from all existing types, including other record types and Scheme's predefined types.
receive: Binding to multiple values
, by John David Stone
Final:
1999-08-30
Keywords:
Binding
Multiple-Value Returns
Library name: receive
See also
SRFI 11: Syntax for receiving multiple values
SRFI 71: Extended LET-syntax for multiple values
, and
SRFI 210: Procedures and Syntax for Multiple Values
The only mechanism that R
RS provides for binding identifiers to the values of a multiple-valued expression is the primitive
call-with-values
. This SRFI proposes a more concise, more readable syntax for creating such bindings.
Feature-based program configuration language
, by Richard Kelsey
Final:
1999-08-19
Keywords:
Features
This SRFI describes a configuration language to be used for specifying the set of Scheme features or extensions required to run a program. In addition to a list of required features, a program may also contain Scheme code to be used only when a particular feature or combination of features is available.
The configuration language is entirely distinct from Scheme; it is neither embedded in Scheme nor includes Scheme as a subset.
Basic String Ports
, by William D Clinger
Final:
1999-07-01
Keywords:
I/O
Operating System
Library name: basic-string-ports
Scheme's i/o primitives are extended by adding three new procedures that
create an input port from a string,
create an output port whose contents are accumulated in Scheme's working memory instead of an external file, and
extract the accumulated contents of an in-memory output port and return them in the form of a string.
A compatible let form with signatures and rest arguments
, by Andy Gaynor
Final:
1999-04-26
Keywords:
Binding
Library name: let
The
named-let
incarnation of the
let
form has two slight inconsistencies with the
define
form. As defined, the
let
form makes no accommodation for rest arguments, an issue of functionality and consistency. As defined, the
let
form does not accommodate signature-style syntax, an issue of aesthetics and consistency. Both issues are addressed here in a manner which is compatible with the traditional
let
form but for minor extensions.
Homogeneous numeric vector datatypes
, by Marc Feeley
Final:
1999-05-22
Keywords:
Data Structure
Numbers
Library name: numeric-vectors
See also
SRFI 160: Homogeneous numeric vector libraries
This SRFI describes a set of datatypes for vectors whose elements are of the same numeric type (signed or unsigned exact integer or inexact real of a given precision). These datatypes support operations analogous to the Scheme vector type, but they are distinct datatypes. An external representation is specified which must be supported by the
read
and
write
procedures and by the program parser (i.e. programs can contain references to literal homogeneous vectors).
List-Set Library
, by Olin Shivers
Withdrawn:
1999-08-26
Keywords:
Data Structure
This SRFI proposes a coherent and comprehensive set of procedures for manipulating lists as sets; it is accompanied by a reference implementation of the spec. The reference implementation is
portable
efficient
completely open, public-domain source
Be aware that these procedures are inherently O(n^2) in the lengths of their parameter lists - serious set operations on large lists should use alternate techniques.
AND-LET*: an AND with local bindings, a guarded LET* special form
, by Oleg Kiselyov
Final:
1999-03-01
Keywords:
Binding
Control Flow
Library name: and-let*
See also
SRFI 202: Pattern-matching Variant of the and-let* Form that Supports Multiple Values
Like an ordinary AND, an AND-LET* special form evaluates its arguments -- expressions -- one after another in order, till the first one that yields #f. Unlike AND, however, a non-#f result of one expression can be bound to a fresh variable and used in the subsequent expressions. AND-LET* is a cross-breed between LET* and AND.
List Library
, by Olin Shivers
Final:
1999-10-09
Keywords:
Data Structure
R7RS Large
R7RS Large: Red Edition
Library name: lists
R5RS
Scheme has an impoverished set of list-processing utilities, which is a problem for authors of portable code. This
SRFI
proposes a coherent and comprehensive set of list-processing procedures; it is accompanied by a reference implementation of the spec. The reference implementation is
portable
efficient
completely open, public-domain source
Feature-based conditional expansion construct
, by Marc Feeley
Final:
1999-05-07
Keywords:
Features
Library name: cond-expand
It is desirable that programs which depend on additions to standard Scheme name those additions. SRFIs provide the specifications of these additions ("features"), and SRFI 0 provides the means to actually check that these features are present in the Scheme system by means of the
cond-expand
construct. It is anticipated that there will be two main classes of features:
sets of value and syntax bindings
reader syntax extensions
("Reader syntax" refers to aspects of the syntax described by the grammars in the Scheme reports.)
The former class of features will probably include most SRFIs, exemplified by the list library specified in
SRFI 1
. The latter class includes Unicode source code support and different kinds of parentheses.
Control over the presence of individual features will vary over different Scheme systems. A given feature may be absent or provided by default in some Scheme systems and in others some mechanism (such as an "import" clause in the code or a program configuration file, a command line option, a dependency declaration in a module definition, etc.) will be required for the feature to be present in the system.
Moreover, in some systems a given feature may be in effect throughout the entire program if it is in effect anywhere at all. Other systems may have more precise mechanisms to control the scope of a feature (this might be the case for example when a module system is supported). In general it is thus possible that a feature is in effect in some parts of the program and not in others. This allows conflicting SRFIs to be present in a given program as long as their scope do not intersect.
SRFI 0 does not prescribe a particular mechanism for controlling the presence of a feature as it is our opinion that this should be the role of a module system. We expect that future module system SRFIs will need to extend the semantics of SRFI 0 for their purposes, for example by defining feature scoping rules or by generalizing the feature testing construct.
Here is
our privacy statement
If you have any general questions about this site, please contact
the SRFI editors
US