[plt-scheme] string-copy! primitive

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 15 16:29:44 EDT 2004

On Jun  5, Neil W. Van Dyke wrote:
> 
> I can use my current algorithm with the slow reference
> implementation "string-copy!", so long as I know a faster
> "string-copy!" is imminent.

A little late, but it took me a while to remember...  This is a way to
imitate a string-copy.  (It's from preprocessor/mztext.ss, except that
the version there has a bug, which is why I remembered this now.)

(define (copy-string! dst skip-k src . ks)
  (if (zero? (string-length src))
    0
    (apply peek-string-avail! dst skip-k (open-input-string src) ks)))

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.