diff --git a/.gitignore b/.gitignore
index e186b71..884f07b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2015 Arthur A. Gleckler
-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 The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with R6RS segregates Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.Table of contents
-
-Table of contents
Table of contents
Abstract
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.Rationale
-!
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.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.
The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.
++Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
+ +!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
- -!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout. +Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout.
icar icdr ... icddadr icddddr ilist-ref +icar icdr ... icddadr icddddr ilist-ref ifirst isecond ithird ifourth ififth isixth iseventh ieighth ininth itenth icar+icdr itake idrop/ilist-tail @@ -304,28 +310,28 @@-Procedure Index
ialist-cons ialist-delete
replace-icar replace-icdr -- -
pair->ipair ipair->pair -list->ilist ilist->list -tree->itree itree->tree -gtree->itree gtree->tree -- -
iapply -- -
ipair-comparator ilist-comparator -make-ilist-comparator make-improper-ilist-comparator +
replace-icar replace-icdr ++ +
pair->ipair ipair->pair +list->ilist ilist->list +tree->itree itree->tree +gtree->itree gtree->tree ++ +
iapply ++ +
ipair-comparator ilist-comparator +make-ilist-comparator make-improper-ilist-comparator make-icar-comparator make-icdr-comparatordiff --git a/srfi-116-1.4.html b/srfi-116-1.4.html index 71174b0..d4a1579 100644 --- a/srfi-116-1.4.html +++ b/srfi-116-1.4.html @@ -1,3 +1,9 @@ + + @@ -178,7 +184,7 @@
-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.
The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.
+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 namedmpair?, 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.
+
+The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.
++Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
+ +!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
- -!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout. +Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout.
icar icdr ... icddadr icddddr ilist-ref +icar icdr ... icddadr icddddr ilist-ref ifirst isecond ithird ifourth ififth isixth iseventh ieighth ininth itenth icar+icdr itake idrop/ilist-tail @@ -304,28 +310,28 @@-Procedure Index
ialist-cons ialist-delete
replace-icar replace-icdr -- -
pair->ipair ipair->pair -list->ilist ilist->list -tree->itree itree->tree -gtree->itree gtree->tree -- -
iapply -- -
ipair-comparator ilist-comparator -make-ilist-comparator make-improper-ilist-comparator +
replace-icar replace-icdr ++ +
pair->ipair ipair->pair +list->ilist ilist->list +tree->itree itree->tree +gtree->itree gtree->tree ++ +
iapply ++ +
ipair-comparator ilist-comparator +make-ilist-comparator make-improper-ilist-comparator make-icar-comparator make-icdr-comparatordiff --git a/srfi-116-1.5.html b/srfi-116-1.5.html index 8fe3364..daa9436 100644 --- a/srfi-116-1.5.html +++ b/srfi-116-1.5.html @@ -1,3 +1,9 @@ + + @@ -178,7 +184,7 @@
-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.
The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.
+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 namedmpair?, 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.
+
+The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible to treat mutable pairs as either a subtype or a supertype of mutable ones; they must be distinct, and if operations are to apply to both, they can do so only by ad hoc polymorphism of the kind that Scheme traditionally avoids for several reasons, including clarity, efficiency, and flexibility. This proposal, therefore, treats mutable and immutable pairs separately, while allowing easy conversion from one to the other.
++Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
+ +!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
- -!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout. +Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout.
icar icdr ... icddadr icddddr ilist-ref +icar icdr ... icddadr icddddr ilist-ref ifirst isecond ithird ifourth ififth isixth iseventh ieighth ininth itenth icar+icdr itake idrop/ilist-tail @@ -304,28 +310,28 @@-Procedure Index
ialist-cons ialist-delete
replace-icar replace-icdr -- -
pair->ipair ipair->pair -list->ilist ilist->list -tree->itree itree->tree -gtree->itree gtree->tree -- -
iapply -- -
ipair-comparator ilist-comparator -make-ilist-comparator make-improper-ilist-comparator +
replace-icar replace-icdr ++ +
pair->ipair ipair->pair +list->ilist ilist->list +tree->itree itree->tree +gtree->itree gtree->tree ++ +
iapply ++ +
ipair-comparator ilist-comparator +make-ilist-comparator make-improper-ilist-comparator make-icar-comparator make-icdr-comparatordiff --git a/srfi-116-test.scm b/srfi-116-test.scm index 9e67f3d..bf97ae7 100644 --- a/srfi-116-test.scm +++ b/srfi-116-test.scm @@ -1,4 +1,8 @@ -(import +;;;; SPDX-FileCopyrightText: 2014 John Cowan
-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.
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.
+
+The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
The first question about this library is why it should exist at all. Why not simply eliminate mutability from Scheme's ordinary pairs and use a version of SRFI-1 that treats the linear-update procedures (with !
) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R5RS and R7RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.
R6RS segregates set-car!
and set-cdr!
into a separate library, thus allowing implementations to provide immutable Scheme pairs if this library is not (transitively) imported into a program, and mutable ones if it is. However, it is not possible to write portable R6RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.
Because of the Liskov Substitution Principle, it is not possible
to treat immutable pairs as either a subtype or a supertype of
mutable ones; they must be distinct, and if operations are to apply
@@ -224,18 +230,18 @@
Rationale
This proposal, therefore, treats mutable and immutable pairs
separately, while allowing easy conversion from one to the other.
-Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
- -!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.-Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout. +Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:
+ +!
i
at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair
, xipair
and ipair*
instead.apply
for applying a procedure to an immutable list of arguments.+Note: In the prose, immutable pairs and lists are known as ipairs and ilists throughout.
icar icdr ... icddadr icddddr ilist-ref +icar icdr ... icddadr icddddr ilist-ref ifirst isecond ithird ifourth ififth isixth iseventh ieighth ininth itenth icar+icdr itake idrop/ilist-tail @@ -314,28 +320,28 @@-Procedure Index
ialist-cons ialist-delete
replace-icar replace-icdr -- -
pair->ipair ipair->pair -list->ilist ilist->list -tree->itree itree->tree -gtree->itree gtree->tree -- -
iapply -- -
ipair-comparator ilist-comparator -make-ilist-comparator make-improper-ilist-comparator +
replace-icar replace-icdr ++ +
pair->ipair ipair->pair +list->ilist ilist->list +tree->itree itree->tree +gtree->itree gtree->tree ++ +
iapply ++ +
ipair-comparator ilist-comparator +make-ilist-comparator make-improper-ilist-comparator make-icar-comparator make-icdr-comparatordiff --git a/srfi-116.meta b/srfi-116.meta index bee7d23..f8a6f26 100644 --- a/srfi-116.meta +++ b/srfi-116.meta @@ -1,4 +1,7 @@ -;; -*- Hen -*- +;;;; -*- Hen -*- +;;;; SPDX-FileCopyrightText: 2014 John Cowan