Skip to content

Comply with REUSE version 3.0 for licensing declaration. #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2015 Arthur A. Gleckler <[email protected]>
#
# SPDX-License-Identifier: MIT

*~
*.swp
*.import.scm
Expand Down
10 changes: 10 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SRFI 116
Upstream-Contact: Arthur A. Gleckler <[email protected]>
Source: https://github.com/scheme-requests-for-implementation/srfi-116

# Sample paragraph, commented out:
#
# Files: src/*
# Copyright: $YEAR $NAME <$CONTACT>
# License: ...
19 changes: 0 additions & 19 deletions LICENSE

This file was deleted.

4 changes: 4 additions & 0 deletions LICENSES/LicenseRef-SRFI1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copyright (c) 1998, 1999 by Olin Shivers. You may do as you please with
this code as long as you do not remove this copyright notice or
hold me liable for its use. Please send bug reports to [email protected].
-Olin
9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2015 Arthur A. Gleckler <[email protected]>
#
# SPDX-License-Identifier: MIT

* SRFI 116: Immutable List Library

** by John Cowan
Expand Down
5 changes: 5 additions & 0 deletions ilists/ilists-base.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
;;;; SPDX-FileCopyrightText: 1998 - 1999 Olin Shivers <[email protected]>
;;;; SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>
;;;;
;;;; SPDX-License-Identifier: LicenseRef-SRFI1 AND MIT

;;;; Enhancements and hooks in Olin's SRFI-1 code to make it work for ilists

;;; The basic ilist cell
Expand Down
5 changes: 5 additions & 0 deletions ilists/ilists-impl.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
;;;; SPDX-FileCopyrightText: 1998 - 1999 Olin Shivers <[email protected]>
;;;; SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>
;;;;
;;;; SPDX-License-Identifier: LicenseRef-SRFI1 AND MIT

;;; SRFI-116 ilist-processing library -*- Scheme -*-
;;; Sample implementation
;;;
Expand Down
4 changes: 4 additions & 0 deletions ilists/ilists-test.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
;;;; SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>
;;;;
;;;; SPDX-License-Identifier: MIT

(use test)
(use srfi-116)

Expand Down
4 changes: 4 additions & 0 deletions ilists/ilists.scm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
;;;; SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>
;;;;
;;;; SPDX-License-Identifier: MIT

(module srfi-116 ()
(import scheme)
;(import srfi-128)
Expand Down
4 changes: 4 additions & 0 deletions ilists/ilists.sld
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
;;;; SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>
;;;;
;;;; SPDX-License-Identifier: MIT

(define-library (ilists ilists)
(import (scheme base))
(import (srfi 128))
Expand Down
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>

SPDX-License-Identifier: MIT
-->

<!DOCTYPE html>
<html>
<head>
Expand Down
6 changes: 6 additions & 0 deletions srfi-116-1.1.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>

SPDX-License-Identifier: MIT
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<!-- This commented out text is for the brittle SRFI tools -->
Expand Down
106 changes: 56 additions & 50 deletions srfi-116-1.3.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<!--
SPDX-FileCopyrightText: 2014 John Cowan <[email protected]>

SPDX-License-Identifier: MIT
-->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<!-- This commented out text is for the brittle SRFI tools -->
Expand Down Expand Up @@ -178,7 +184,7 @@ <h1>Table of contents</h1>
<ul>
<li><a href="#ImproperIlists">Improper ilists</a>
</li></ul>
<li><a href="#Quotation">Quotation</a></li>
<li><a href="#Quotation">Quotation</a></li>
<li><a href="#TheProcedures">The procedures</a>
<ul>
<li><a href="#Constructors">Constructors</a>
Expand All @@ -190,13 +196,13 @@ <h1>Table of contents</h1>
</li><li><a href="#Searching">Searching</a>
</li><li><a href="#Deletion">Deletion</a>
</li><li><a href="#ImmutableassociationLists">Immutable association lists</a>
</li><li><a href="#Replacers">Replacers</a>
</li><li><a href="#Conversion">Conversion</a>
</li><li><a href="#ProcedureApplication">Procedure application</a>
</li><li><a href="#Comparators">Comparators</a>
</li><li><a href="#Replacers">Replacers</a>
</li><li><a href="#Conversion">Conversion</a>
</li><li><a href="#ProcedureApplication">Procedure application</a>
</li><li><a href="#Comparators">Comparators</a>
</li></ul>
</li><li><a href="#SampleImplementation">Sample Implementation</a>
</li><li><a href="#Acknowledgements">Acknowledgements</a>
</li><li><a href="#SampleImplementation">Sample Implementation</a>
</li><li><a href="#Acknowledgements">Acknowledgements</a>
</li><li><a href="#ReferencesLinks">References &amp; links</a>
</li><li><a href="#Copyright">Copyright</a>
</li></ul>
Expand All @@ -205,27 +211,27 @@ <h1>Table of contents</h1>
<!--========================================================================-->
<h1><a name="Abstract">Abstract</a></h1>
<p>
Scheme currently does not provide immutable pairs corresponding to its existing mutable pairs, although most uses of pairs do not exploit their mutability. The <a href="http://www.racket-lang.org">Racket</a> system takes the radical approach of making Scheme's pairs immutable, and providing a minimal library of mutable pairs with procedures named <code>mpair?, mcons, mcar, mcdr, set-mcar!, set-mcdr!</code>. 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.</p>

<h1><a name="Rationale">Rationale</a></h1>
<p>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 <code>!</code>) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R<sup>5</sup>RS and R<sup>7</sup>RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.</p>

<p>R<sup>6</sup>RS segregates <code>set-car!</code> and <code>set-cdr!</code> 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 R<sup>6</sup>RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.</p>

<p>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 <em>ad hoc</em> 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.</p>
Scheme currently does not provide immutable pairs corresponding to its existing mutable pairs, although most uses of pairs do not exploit their mutability. The <a href="http://www.racket-lang.org">Racket</a> system takes the radical approach of making Scheme's pairs immutable, and providing a minimal library of mutable pairs with procedures named <code>mpair?, mcons, mcar, mcdr, set-mcar!, set-mcdr!</code>. 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.</p>

<h1><a name="Rationale">Rationale</a></h1>
<p>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 <code>!</code>) as identical to their functional counterparts, as Racket does? The main answer is that this approach breaks R<sup>5</sup>RS and R<sup>7</sup>RS-small. All the data structures in these versions of Scheme are inherently mutable, and portable code is allowed to depend on that property.</p>

<p>R<sup>6</sup>RS segregates <code>set-car!</code> and <code>set-cdr!</code> 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 R<sup>6</sup>RS programs that differentiate between mutable and immutable pairs, for example by using immutable pairs most of the time and mutable pairs where necessary.</p>

<p>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 <em>ad hoc</em> 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.</p>
<p>
Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying <a href="http://srfi.schemers.org/srfi-1/srfi-1.html">SRFI 1</a>. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:</p>

<ul><li>Removed all linear-update procedures ending in <code>!</code></li>
<li>Removed all references to circular lists (there will be a future SRFI for immutable bidirectional cycles).</li>
<li>Removed the O(n<sup>2</sup>) lists-as-sets procedures (there will be a future SRFI supporting O(log n) immutable sets).</li>
<li>Inserted an <code>i</code> 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 <code>ipair</code>, <code>xipair</code> and <code>ipair*</code> instead.</li>
<li>Added procedures for conversion between ordinary and immutable pairs, lists, and trees.</li>
<li>Added an analogue of <code>apply</code> for applying a procedure to an immutable list of arguments.</li>
<li>Added SRFI 114 comparators for immutable pairs, lists, and dotted lists.</li></ul>

<p>
Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying <a href="http://srfi.schemers.org/srfi-1/srfi-1.html">SRFI 1</a>. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes:</p>

<ul><li>Removed all linear-update procedures ending in <code>!</code></li>
<li>Removed all references to circular lists (there will be a future SRFI for immutable bidirectional cycles).</li>
<li>Removed the O(n<sup>2</sup>) lists-as-sets procedures (there will be a future SRFI supporting O(log n) immutable sets).</li>
<li>Inserted an <code>i</code> 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 <code>ipair</code>, <code>xipair</code> and <code>ipair*</code> instead.</li>
<li>Added procedures for conversion between ordinary and immutable pairs, lists, and trees.</li>
<li>Added an analogue of <code>apply</code> for applying a procedure to an immutable list of arguments.</li>
<li>Added SRFI 114 comparators for immutable pairs, lists, and dotted lists.</li></ul>

<p>
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.
</p>
<!--========================================================================-->
<h1><a name="ProcedureIndex">Procedure Index</a></h1>
Expand All @@ -251,7 +257,7 @@ <h1><a name="ProcedureIndex">Procedure Index</a></h1>

</dd><dt class="proc-index"> Selectors
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#icar">icar</a> <a href="#icdr">icdr</a> ... <a href="#icddadr">icddadr</a> <a href="#icddddr">icddddr</a> <a href="#ilist-ref">ilist-ref</a>
<pre class="proc-index"><a href="#icar">icar</a> <a href="#icdr">icdr</a> ... <a href="#icddadr">icddadr</a> <a href="#icddddr">icddddr</a> <a href="#ilist-ref">ilist-ref</a>
<a href="#ifirst">ifirst</a> <a href="#isecond">isecond</a> <a href="#ithird">ithird</a> <a href="#ifourth">ifourth</a> <a href="#ififth">ififth</a> <a href="#isixth">isixth</a> <a href="#iseventh">iseventh</a> <a href="#ieighth">ieighth</a> <a href="#ininth">ininth</a> <a href="#itenth">itenth</a>
<a href="#icar+icdr">icar+icdr</a>
<a href="#itake">itake</a> <a href="#idrop">idrop</a>/<a href="#ilist-tail">ilist-tail</a>
Expand Down Expand Up @@ -304,28 +310,28 @@ <h1><a name="ProcedureIndex">Procedure Index</a></h1>
<a href="#ialist-cons">ialist-cons</a> <a href="#ialist-delete">ialist-delete</a>
</pre>

</dd><dt class="proc-index"> Replacement
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#replace-icar">replace-icar</a> <a href="#replace-icdr">replace-icdr</a>
</pre>
</dd><dt class="proc-index"> Conversion
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#pair->ipair">pair->ipair</a> <a href="#ipair->pair">ipair->pair</a>
<a href="#list->ilist">list->ilist</a> <a href="#ilist->list">ilist->list</a>
<a href="#tree->itree">tree->itree</a> <a href="#itree->tree">itree->tree</a>
<a href="#gtree->itree">gtree->itree</a> <a href="#gtree->tree">gtree->tree</a>
</pre>
</dd><dt class="proc-index"> Procedure application
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#iapply">iapply</a>
</pre>
</dd><dt class="proc-index"> Comparators
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#ipair-comparator">ipair-comparator</a> <a href="#ilist-comparator">ilist-comparator</a>
<a href="#make-ilist-comparator">make-ilist-comparator</a> <a href="#make-improper-ilist-comparator">make-improper-ilist-comparator</a>
</dd><dt class="proc-index"> Replacement
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#replace-icar">replace-icar</a> <a href="#replace-icdr">replace-icdr</a>
</pre>

</dd><dt class="proc-index"> Conversion
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#pair->ipair">pair->ipair</a> <a href="#ipair->pair">ipair->pair</a>
<a href="#list->ilist">list->ilist</a> <a href="#ilist->list">ilist->list</a>
<a href="#tree->itree">tree->itree</a> <a href="#itree->tree">itree->tree</a>
<a href="#gtree->itree">gtree->itree</a> <a href="#gtree->tree">gtree->tree</a>
</pre>

</dd><dt class="proc-index"> Procedure application
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#iapply">iapply</a>
</pre>

</dd><dt class="proc-index"> Comparators
</dt><dd class="proc-index">
<pre class="proc-index"><a href="#ipair-comparator">ipair-comparator</a> <a href="#ilist-comparator">ilist-comparator</a>
<a href="#make-ilist-comparator">make-ilist-comparator</a> <a href="#make-improper-ilist-comparator">make-improper-ilist-comparator</a>
<a href="#make-icar-comparator">make-icar-comparator</a> <a href="#make-icdr-comparator">make-icdr-comparator</a>
</pre>

Expand Down
Loading