This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: read-into-string


> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]