I wasn't able to find in the Racket documentation a string function that replaces substrings in a string based on the content of the substring. Something similar to Python's string replace method . s = "abcdefabcdef" s.replace("abc" "123") -> "123def123def"
But more surprising, I also wasn't able to find such a function in SRFI13 which is supposed to be a comprehensive set of operations on strings. Its string-replace function is based on position not on content of the substring. Is there some functional programming reason for not having such a built-in function in Racket/Scheme, or is the idea that you use regular expressions to do this. My understanding is that regular expressions can be quite expensive. I have Python programs which convert Indian language book length etexts from one transliteration scheme to another so I'm calling the Python replace function hundreds of thousands of times per e-text and doing multiple replaces with each call. I'd like to convert these programs to Racket, but using regular expressions might be too slow. Is writing a C foreign function. extension my only alternative or is there such a function in some Racket package.. Thanks, Harry Spier ____________________ Racket Users list: http://lists.racket-lang.org/users