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

2012-02-08 Thread Neil Van Dyke
Harry Spier wrote at 02/08/2012 10:45 PM: Neil wrote: You could do it by hand, using reading primitives ... Do you mean by creating a new readtable? I wasn't clear. I meant things like "read-char". -- http://www.neilvandyke.org/ Racket Users list: http://lis

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

2012-02-08 Thread Harry Spier
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 t

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

2012-02-07 Thread Matthias Felleisen
1. I am surprised that regexp-replace* does not work on input-ports like all other regexp- functions. I assume Matthew has a rationale but my quick look didn't discover it in the docs. 2. I ran this stupid little program below. The timing for a file of 19990186 chars over 9896 lines, with 992

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

2012-02-07 Thread Sam Tobin-Hochstadt
On Tue, Feb 7, 2012 at 8:05 PM, Harry Spier wrote: > > I'd like to convert these programs to Racket, but using regular > expressions might be too slow. I find that my intuitions about what might or might not be too slow are usually wrong. Have you tried measuring this? -- sam th sa...@ccs.neu.e

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

2012-02-07 Thread Neil Van Dyke
Harry Spier wrote at 02/07/2012 08:05 PM: 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. What