Changeset 39209 in project
- Timestamp:
- 11/10/20 19:23:21 (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/srfi-196
r39194 r39209 16 16 === Specification 17 17 ==== Preliminary notes 18 =====Ranges belong to a disjoint type.19 ===== Ranges provide certain running time guarantees. 20 =====With each range, we associate two lengths of time, the average accessing time and the total accessing time.18 Ranges belong to a disjoint type. 19 20 Ranges provide certain running time guarantees. With each range, we associate two lengths of time, the average accessing time and the total accessing time. 21 21 The total accessing time is the average accessing time multiplied by the length of the range. In the runtime guarantees below, the time spent in arguments designated by {{pred}}, equal, or {{proc}} is ignored. 22 ===== Unless otherwise noted, procedures in this SRFI that return ranges allocate at most O(1) new locations (see R[57]RS section 3.4 for further information). Such ranges are known as compact ranges. Procedures marked as returning expanded ranges allocate at most O(n) locations, where {{n}} is the number of elements in the range. 23 ===== This SRFI recommends, but does not require, that Scheme implementations which also provide SRFI 42 modify it so that the typed generator :range also accepts a single argument which is a range in the sense of this SRFI. This feature should be used with caution, as SRFI 42 loops expect that :range iterates only over exact rationals. 24 ===== The following names are used for arguments to procedures: 22 23 Unless otherwise noted, procedures in this SRFI that return ranges allocate at most O(1) new locations (see R[57]RS section 3.4 for further information). Such ranges are known as compact ranges. Procedures marked as returning expanded ranges allocate at most O(n) locations, where {{n}} is the number of elements in the range. 24 25 The following names are used for arguments to procedures: 25 26 26 27 <parameter>obj</parameter> … … 59 60 60 61 A Scheme string. 61 ===== It is an error (unless otherwise noted) if the procedures are passed arguments that do not have the type implied by the argument names. 62 63 It is an error (unless otherwise noted) if the procedures are passed arguments that do not have the type implied by the argument names. 64 62 65 ==== Constructors 63 66 … … 65 68 66 69 Returns a range whose length (number of elements) is length. The indexer procedure returns the nth element (where {{0 †n < length}}) of the range, given {{n}}. This procedure must run in O(1) time. The range returned is compact, although indexer may close over arbitrarily large data structures. The average accessing time of the resulting range is the average time needed to run indexer. 67 ====== Examples: 70 71 ====== Examples 68 72 <enscript highlight="scheme"> 69 73 (range->list (range 26 (lambda (n) (integer->char (+ 65 n)))))
Note: See TracChangeset
for help on using the changeset viewer.