Subject: Re: Search & Replace in sequences
From: Erik Naggum <erik@naggum.no>
Date: 2000/03/20
Newsgroups: comp.lang.lisp
Message-ID: <3162509869683633@naggum.no>

* Rudolf Schlatte
| This works ok and the program does not have to run fast or anything, but
| all this repeated string-building just feels wrong for me.  Are there
| more concise ways of writing this?

  yes, use with-output-to-string and write characters and strings to the
  string stream with stream primitives like write-char and write-string.
  the underlying buffering mechanism is very well optimized for growing
  strings, which is what you are doing in an excessively expensive way.

  C and Perl don't have string streams, so every C and Perl programmer
  thinks in-memory string processing is more efficient than streams and
  that you always benefit from doing your own buffering algorithm.  neither
  is, was, or will become true.  languages shape the way we think, or don't.

#:Erik