Email list hosting service & mailing list manager

comments on new draft Alex Shinn (03 Apr 2016 03:49 UTC)
Re: comments on new draft John Cowan (03 Apr 2016 06:16 UTC)

comments on new draft Alex Shinn 03 Apr 2016 02:59 UTC

In general, I like the new approach.  I think it should be
emphasized that even with index input parameters, the
procedures always return cursors, and that the use of
indexes is preserved mostly for existing code and for
implementor convenience.  If users want to write portable
code that works with cursor-oriented implementations
they can't assume cursors are integers.

It's not clear if it's allowed to pass just a start parameter
with no end, which is very convenient (see an example
below).

The following example for string-{index,skip}[-right] is
no longer valid since it assumes the predicate can be
a char-set, and that the return value can be #f:

  (cond ((string-skip s char-set:whitespace) =>
         (lambda (i) ...)) ; s[i] is not whitespace.
        ...)

Instead, "to skip over initial whitespace":

  (let ((cur (string-skip s char-whitespace?)))
    ...)  ; cur is the end cursor or (string-ref/cursor s cur) is not whitespace

Or to trim the leading whitespace without checking the
result you can use:

  (substring/cursors s (string-skip s char-whitespace?))

which is equivalent to simply:

  (string-trim s)

Would not string-for-each-cursor be more useful than
string-for-each-index?

--
Alex