From 86c0d1caee3678e3442e0e8545b05f93f5c285cf Mon Sep 17 00:00:00 2001 From: "Arthur A. Gleckler" Date: Thu, 18 Mar 2021 15:30:34 -0700 Subject: copy edits --- srfi-214.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/srfi-214.html b/srfi-214.html index 61c938d..fd6c56d 100644 --- a/srfi-214.html +++ b/srfi-214.html @@ -22,8 +22,8 @@

Abstract

A 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.

Rationale

-

Unlike the default vector datatype of many other languages, Scheme vectors have a fixed length. This makes vectors unusable as mutable stacks or queues, and is the reason that SRFI 133 lacks common collection operations like filter.

-

In fact, no Scheme standard defines a mutable datatype that is suitable for this very common purpose, analogous to a Java ArrayList or to the default list data structure in JavaScript or Python. SRFI 117 defines the commonly-used "tconc" mutable queue, but it is a linked list. And SRFI 134 defines a deque datatype, but that datatype is immutable. Neither data structure has the (often useful) properties of being a mutable, contiguous, random-access sequence.

+

Unlike the default vector data type of many other languages, Scheme vectors have a fixed length. This makes vectors unusable as mutable stacks or queues, and is the reason that SRFI 133 lacks common collection operations like filter.

+

In fact, no Scheme standard defines a mutable data type that is suitable for this very common purpose, analogous to a Java ArrayList or to the default list data structure in JavaScript or Python. SRFI 117 defines the commonly-used "tconc" mutable queue, but it is a linked list. And SRFI 134 defines a deque data type, but that data type is immutable. Neither data structure has the (often useful) properties of being a mutable, contiguous, random-access sequence.

This SRFI does not define a comparator or any sorting procedures, in order to ensure that it has no dependencies. These may be defined in future SRFIs.

Terminology

What this SRFI calls a flexvector is better known as a dynamic array. This data structure has a wide variety of names in different languages:

@@ -37,7 +37,7 @@

This SRFI is primarily modeled on SRFI 133. It includes flexvector equivalents of all SRFI 133 procedures, most with the same names and argument order. There are three notable exceptions:

  1. flexvector-unfold mimics the API of SRFI 1's unfold, not SRFI 133's vector-unfold. vector-unfold is limited by the necessity of a fixed vector length, while flexvector-unfold may generate a flexvector of any length, and so the unfold API is more useful.
  2. -
  3. There is no flexvector equivalent of vector-unfold!, because flexvectors use the list version of unfold, which has no unfold! equivalent with a similar API.
  4. +
  5. There is no flexvector equivalent of vector-unfold! because flexvectors use the list version of unfold, which has no unfold! equivalent with a similar API.
  6. The flexvector equivalent of vector= is flexvector=?. It is conventional for Scheme equality predicates to end in =? (e.g., symbol=?, string=?), and most data structure SRFIs follow this convention (see SRFI 113, 125, 146). This SRFI follows established convention, even when it does not match SRFI 133's procedure names.

Additionally, this SRFI includes deque-like operations that reference, add to, and remove from both ends of a flexvector. The naming convention for these operations is taken from SRFI 134, which uses the terms front and back. Front refers to the start of the flexvector (index 0), while back refers to the end (index (- (flexvector-length x) 1)).

@@ -61,7 +61,7 @@

λ is a shorthand alias for lambda.

-

Additionally, examples include literal flexvector values written in pseudo-lexical syntax: #<flexvector a b c> is a flexvector of length 3 containg the symbol values a, b, and c. This syntax is only used for example purposes. This SRFI does not define the #<flexvector ...> syntax for actual use.

+

Additionally, examples include literal flexvector values written in pseudo-lexical syntax: #<flexvector a b c> is a flexvector of length 3 containing the symbol values a, b, and c. This syntax is only used for example purposes. This SRFI does not define the #<flexvector ...> syntax for actual use.

API