[racket] Why no string function to replace substring based on content in Racket

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Wed Feb 8 22:45:38 EST 2012

Thanks Neil, Sam and Matthias
You guys are great.

Matthias wrote:
> 2. I ran this stupid little program below. The timing for a file of 19990186 chars over 9896 lines, with 9922 occurrences of "abc" clocks in like this:
>
> cpu time: 4570 real time: 4629 gc time: 2164
>
> How much too slow is this?
>
It might be fast enough so I'll run a test..  A large e-text is about
50,000 lines of about 100 characters per line..  I'm testing for about
20 different character pairs, and each line would typically contain
about 20 or 30 of these character pairs.

Neil wrote:
>You could do it by hand, using reading primitives ...

Do you mean by creating a new readtable?  Is it possible to modify the
readtable so that it parses a character pair and outputs a single
character.  For example is it possible to modify it so that when it
reads aa  it outputs A  etc.

Thanks again,
Harry Spier

Posted on the users mailing list.