Re: SRFI 152 string-unfold contradictions
Wolfgang Corcoran-Mathe 16 Oct 2026 18:07 UTC
Shiro,
On 2026-10-15 10:14 -1000, Shiro Kawai wrote:
> And it's not only string-unfold / string-unfold-right. SRFI-152's
> string-map also allows proc to return a string (even it is shown in
> the example).
Thanks for spotting that. Clearly there are more changes hiding in
SRFI 152.
I also noticed another way in which ‘string-map’ differs from R7RS:
> If any strings returned by proc are mutated after they have
> been returned and before the call to string-map has returned, then
> string-map returns a string with unspecified contents; the string-map
> procedure itself does not mutate those strings.
This requirement isn’t present in R7RS. What R7RS *does* require that
SRFI 152 doesn’t is the basic ‘map’ variety of continuation safety:
> If multiple returns occur from string-map, the values returned by
> earlier returns are not mutated.
So SRFI 152’s procedure is both stricter and laxer than the R7RS
version. I find this rather confusing. It certainly presents a
headache for the plan to base R7RS-large’s string library on SRFI 152.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>