Re: Daily digest for srfi-130@srfi.schemers.org
John Cowan 15 Apr 2016 20:07 UTC
Jim Rees scripsit:
> 1) minor formatting problem in the text - no space between "substring"
> and " *final-string*"
Fixed.
> 2) Can 'end' be a string-cursor? The naming conventions would suggest
> so, but the text and examples only refer to an index interpretation.
It can be, yes, and I have adjusted the wording to speak of "the
characters up to but not including *end*", and made the explanation use
(string-cursor-start final-string) instead of 0. But all the examples
are in terms of indexes, including this one, so I have left it alone.
> string-concatenate is in the list of procedures permitted to return
> shared storage/eq?-to-argument, but the specific documentation for
> the procedure says "Guaranteed to return a freshly allocated string".
That's a genuine issue. SRFI 13 has both string-concatenate, which
prohibits sharing, and string-concatenate/shared. Parallelism with
string-append suggests prohibiting sharing, but how much sense does
that make if there is only one string (the normal case for sharing)?
I'll go with making string-concatenate and string-concatenate-reverse
both non-sharing, just to have a resolution.
> string-for-each-cursor -- the example code makes no sense. The binding for
> LEN is unused.
The example is what happened when I took the SRFI 13 example for
string-for-each-index, which reverses a string by mutation, and whack
on it, combined with the fact that the example had an off-by-one error
anyway. I've taken the string-for-each example from R7RS-small and
adapted it.
> Does proc take a cursor or a character? The doc says "apply proc
> to each cursor". Maybe you meant to retain the semantics of
> string-for-each/cursors from the previous version of the doc?
The semantics given is correct: the proc is applied to each cursor.
The trouble now is that there is no version of string-for-each
that accepts cursors as arguments. If there were, it would be
called string-for-each/cursors, but I rebel against having both
string-for-each/cursors and string-for-each-cursor. I'll leave the
semantics alone.
> string-replicate: The first example, either the TO argument is a typo,
> or the result is. I think TO should be 8, not 4 to get a 6-character
> string result.
Changed 4 to 8: a brain fart while converting the SRFI 13 examples.
Thanks again for all your help.
--
John Cowan http://www.ccil.org/~cowan xxxxxx@ccil.org
Andrew Watt on Microsoft: Never in the field of human computing has so
much been paid by so many to so few! (pace Winston Churchill)