[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: string-escaper

This page is part of the web mail archives of SRFI 13 from before July 7th, 2015. The new archives for SRFI 13 contain all messages, not just those from before July 7th, 2015.

At 02:28 PM 11/22/99 -0500, brlewis@xxxxxxxxxxxx wrote:
>All of these are cases of escaping single characters
>into multiple characters for the output string.  I think the string
>library would be more useful with some efficient mechanism for
>(escaping single characters into multiple characters).

While this could be done with my version of string-filter (in fact, it's
the sort of thing I had in mind), I'm now tending to the view that this is
better done by using string ports.  Would anyone care to comment?

Here's my reasoning:  string-filter is like "map", an iterator over a
collection.  Having a version that allows single -> multiple character
transforms allows the output string to be an expanded or contracted version
of its input.

In this case, we want to accumulate the stream of transformed characters
into an output string.  This is a good use for string-fold with a string port.