This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: read-into-string
- To: russell dot mcmanus at msdw dot com
- Subject: Re: read-into-string
- From: Gary Houston <ghouston at arglist dot com>
- Date: 17 Apr 2000 19:43:26 -0000
- CC: guile at sourceware dot cygnus dot com
- References: <200004131126.HAA15179@hqsmh3.ms.com>
> Date: Thu, 13 Apr 2000 07:26:41 -0400 (EDT)
> From: Russell McManus <russell.mcmanus@msdw.com>
>
> Is there a way in guile-1.3.4 to implement this function so that
> it runs in a reasonable amount of time? I am trying to do something
> analgous to CL's read-sequence.
>
> (define (read-into-string str port)
> (let ((len (string-length str)))
> (do ((i 0 (1+ i)))
> ((= i len) str)
> (string-set! str i (read-char port)))))
uniform-array-read! would probably be faster: it works fine on a
string. Also make sure the port is buffered: reading from unbuffered
ports is somewhat inefficient with the current implementation.