Subject: Re: string assembly in lisp?? help??
From: Erik Naggum <erik@naggum.no>
Date: 1999/03/19
Newsgroups: comp.lang.lisp
Message-ID: <3130830747000326@naggum.no>

* Lars Marius Garshol <larsga@ifi.uio.no>
| You seem to be correct about this. I didn't know this about COERCE, and I
| also wasn't aware of the possibility of directly modifiying strings like
| this. (The explanation of this perhaps surprising ignorance is that I'm a
| Lisp newbie. :)
| 
| (format t "Trying vector approach.~%")
| (time
|  (dotimes (ix 10000 'ok)
|    (let ((str (make-array 30 :fill-pointer 0 :adjustable t)))
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (vector-push-extend #\a str)
|      (setq str (coerce str 'string)))))

  try it like this, instead:

(make-array 30 :fill-pointer 0 :adjustable t :element-type 'character)

  BTW, if you have to time things, you might as well do it with proper
  declarations and optimizations.  otherwise, you don't know what you're
  timing.

#:Erik