[plt-scheme] mutable strings

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Aug 21 18:33:47 EDT 2006

On Aug 21, 2006, at 6:16 PM, Paul Graham wrote:

> We're trying to undo Scheme's fussiness about immutable strings.
> More precisely, we're writing another language that macroexpands
> into Scheme code, and in this language you can modify strings.
>
> Is it possible to have a mutable string within a mzscheme function?
>
> Because I'd considered, for example, hacking the reader so that
> a double-quoted string was copied on being read in, and the copy,
> which was therefore mutable, was used in the code.  But can you
> even have a mutable string within code?

Do you mean something like this?

 > (define foo (list->string (string->list "hello world")))
 > (string-set! foo 3 #\x)
 > foo
"helxo world"





Posted on the users mailing list.