[plt-scheme] efficient string operations yielding immutable strings

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Mar 26 08:34:18 EST 2004

As Paul Graham likes to point out, Lisp (and Scheme is one in his mind) 
uses library names that are way too long. Let's use strung. And for 
substringing you can say strung-out. -- Matthias

On Mar 25, 2004, at 11:40 PM, Neil W. Van Dyke wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> Motivation: Now that I've started coding with immutable strings, 
> mutable
> strings are seeming more and more like a special case, and rarely what 
> I
> want.  I've written some convenience procedures like
> "substring-immutable" and "string-append-immutable" that apply
> "string->immutable-string" to the result of the familiar standard
> procedures.  From looking at the MzScheme C code, it seems these
> convenience procedures of mine are grossly inefficient compared to how
> they would be implemented as primitives (they, e.g., cause 2 or 3 
> string
> allocations, when only 0 or 1 is necessary).
> Question: If I were to implement a set of string operation primitives
> that always yield immutable strings, can someone suggest a visually
> lightweight naming convention?  "substring-immutable",
> "string-append-immutable", "string-lowercase-immutable", etc. seem
> bulky.  I don't really want to use a non-alphanumeric character as a
> suffix for this.
> P.S.: If there were a mutating operation that turned a mutable string
>       immutable, that might be helpful in some cases, but I imagine
>       it would overconstrain the Scheme implementation's internals.
> -- 
> http://www.neilvandyke.org/

Posted on the users mailing list.