| From: Thomas Lord <[email protected]> | Date: Sat, 19 Sep 2009 15:49:47 -0700 | | On Sat, 2009-09-19 at 01:24 -0400, John Cowan wrote: | [....] | > 2) Algorithms where you want to modify strings in the middle are rare, | | Claims like this always make the hairs on the back of my | neck stand up. There are two problems with them. | First, there isn't a really good empirical way to establish | such claims. Second, rarity per se, is not the most | important consideration. | | Surely if we scan the source for PLT or various Scheme | compilers, SLIB, and similar systems we'll find that | string mutation is less common than immutable uses of | strings. Well, I haven't actually *checked* but I wouldn't | be surprised. Still, that tells us little about what | code there is that we can't see and won't here about and it | tells us even less about what kinds of code people will | want to write in 3 years.
Here are the occurences of string-set! in SLIB: array.scm:375: ((if (string? store) string-set! vector-set!) Uniform character arrays. byte.scm:89: (string-set! new idx (integer->char (byte-ref bts idx)))))) Byte-vectors implemented from strings. chap.scm CHAP:NEXT-STRING increments (in the lexicographic order) a copy of a given string. format.scm:725: (string-set! format:fn-str format:fn-len c) format.scm:728: (string-set! format:en-str format:en-len c) format.scm:769: (string-set! format:en-str format:en-len c) format.scm:779: (string-set! format:fn-str i format.scm:785: (string-set! format:fn-str i #\0)))) format.scm:794: (string-set! format:fn-str (- i n) (string-ref format:fn-str i)))) format.scm:805: (string-set! format:fn-str 0 #\1) format.scm:810: (string-set! format:fn-str i (integer->char format.scm:837: (string-set! format:fn-str format:fn-len #\0) format.scm:1631: (string-set! cap-str i (char-downcase c)) format.scm:1634: (string-set! cap-str i (char-upcase c))))))))) genwrite.scm:261: (string-set! result k (string-ref str j)) getparam.scm:109: (string-set! str i #\-)))))) http-cgi.scm:88: (string-set! str idx chr) http-cgi.scm:317: (string-set! str idx chr) lineio.scm:60: (string-set! str i char))))) matfile.scm:129: (string-set! namstr idx (read-char port))) printf.scm:171: (string-set! res i printf.scm:175: (string-set! res i #\0) printf.scm:573: (string-set! s cnt (string-ref x i)) printf.scm:583: (string-set! s cnt (if (char? x) x #\?)) sc2.scm:26: (string-set! string2 j (string-ref string1 i)))) sc2.scm:33: (string-set! string2 j (string-ref string1 i)))) sc2.scm:39: (string-set! string i char))) sc4opt.scm:35: (string-set! s i obj))) scanf.scm:105: (string-set! str i (read-input-char)))))))) scanf.scm:225: (string-set! str i (read-input-char))))) strcase.scm:20: (string-set! str i (char-upcase (string-ref str i))))) strcase.scm:28: (string-set! str i (char-downcase (string-ref str i))))) strcase.scm:41: (string-set! str i (char-downcase c)) strcase.scm:44: (string-set! str i (char-upcase c)))) strport.scm:39: (string-set! buf i c) transact.scm:116: (string-set! str idx (read-char iport)) transact.scm:121: (string-set! name idx (read-char iport)) vet.scm:53: string-ci>? string-length string-ref string-set! string<=? xml-parse.scm:263: (string-set! buffer i c) xml-parse.scm:313: (string-set! buffer i c) xml-parse.scm:331: (string-set! buffer i c) xml-parse.scm:349: (else (string-set! buffer idx chr)))))) yasyn.scm:27: (cons string-ref string-set!)) _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
