summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Daphne Preston-Kendal 2021-12-29 18:25:21 +0100
committerGravatar Daphne Preston-Kendal 2021-12-29 18:25:21 +0100
commit55541b648c5d0c6879f0218687033eef4965663e (patch)
tree32fe0ec29c99975305c05a6a22ead07a28d601cc
parentAdd make-sum-comparator and use the term ‘product comparator’ more (diff)
Express hope for a iteration solution
Diffstat (limited to '')
-rw-r--r--srfi-228.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/srfi-228.html b/srfi-228.html
index 4764a87..0bc4e27 100644
--- a/srfi-228.html
+++ b/srfi-228.html
@@ -61,7 +61,9 @@
<p class=issue>As long as we’re stuck with positional return values, I should note that this isn’t the order usually used for the specification of comparison procedures (e.g. the <code>char*?</code> family in R7RS small uses the order <code>char=?</code>, <code>char&lt;?</code>, <code>char&gt;?</code>. <code>char&lt;=?</code>, <code>char&gt;=?</code>). I find the order here easier to remember, but perhaps it would be better to switch to that order for consistency.</p>
</dl>
-<p class=issue>I’d also like to provide a constructor for comparators which work on any iterable collection type (à la SRFI 158 generators). My initial plan was to use fold procedures for this, but that doesn’t actually work. Generator comparators seems like a better approach.</p>
+<h2 id=further-work>Further work</h2>
+
+<p>The author hopes that a future SRFI will add a procedure for creating comparators yielding lexicographical order over any sequence type by delegating to a common iteration protocol. An idea to do this using <code>fold</code> procedures foundered on two grounds: the first and more intrinsic one is that <code>fold</code> called on two sequences, one of which is a prefix of the other, cannot determine which of the two is longer, and a sort using <code>fold</code>-based iteration would incorrectly consider them equal; the second is that there is currently an inconsistency among Scheme libraries in what order the <var>kons</var> procedure argument to <code>fold</code> receives the accumulator and the next values in the sequence (compare <a href="https://srfi.schemers.org/srfi-1/srfi-1.html#fold">SRFI 1 <code>fold</code></a> with <a href="https://srfi.schemers.org/srfi-133/srfi-133.html#vector-fold">SRFI 133<code>vector-fold</code></a>). <a href="https://srfi.schemers.org/srfi-158/srfi-158.html">SRFI 158</a> generators were rejected on the ground that their sequences cannot contain any arbitrary Scheme datum.
<h2 id=examples>Examples</h2>