Email list hosting service & mailing list manager


Re: string-escaper Donald Welsh 25 Nov 1999 16:01 UTC

At 02:28 PM 11/22/99 -0500, xxxxxx@alum.mit.edu 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.