Email list hosting service & mailing list manager


Additional SRFI 130 procedures? John Cowan 03 Apr 2016 09:08 UTC

I'm adding string-reverse, which was omitted by accident from SRFI 130.

I'm also considering whether or not to add string-map/cursors and
string-for-each/cursors.  These are more problematic, however, because
R7RS and SRFI 13 have different signatures.  The SRFI 13 signature of
string-map is just (string-map f s [start end]), which maps a unary
char->char function onto the substring of s from start to end.  However,
in R7RS the signature tracks regular map, and is (string-map f s1 s2 ...),
where the arity of f must be equal to the number of strings.  The same
story holds for string-for-each.

Now the regular signature pattern for SRFI 13 and 130 procedures that
accept multiple strings is to append [start1 end1 start2 end2].  Following
that pattern with string-map/cursors would produce (string-map/cursors
f s1 s2 ... [start1 end1 start2 end2 ...]).  This can be done, since
strings are disjoint from indexes/cursors.  The question is, is it more
complicated than it is worth?

--
My .sigs are from my large and miscellaneous reading both on and off the net.
Occasionally I hear one viva voce or make one up (without attribution,
of course).  I try to stay within the McQuary limit, but sometimes fail,
as in this case.  In general, the quotes are chosen at random by a script
from <http://www.ccil.org/~cowan/signatures>, but sometimes I choose one
on purpose.  I've been collecting and using them for 30+ years.