Re: I/O, modules

2012-11-13 Thread Ian Price
tanta...@gmx.net writes: > The (ice-9 streams) module could be interesting, too. > http://www.gnu.org/software/guile/manual/html_node/Streams.html When it gets merged into master/stable-2.0, I'd suggest using (srfi srfi-41) rather than (ice-9 streams). It cures the off-by-1 problems that frequent

Re: I/O, modules

2012-11-13 Thread Ian Price
Mark H Weaver writes: > As shown in the upcase program above, (read-delimited "" port) will read > the whole file as a string. You need to (use-modules (ice-9 rdelim)) to > import this procedure. A perhaps more lucid way is to use get-string-all from (rnrs io ports) -- Ian Price -- shift-rese

Re: I/O, modules

2012-11-13 Thread tantalum
Hi The (ice-9 streams) module could be interesting, too. http://www.gnu.org/software/guile/manual/html_node/Streams.html Example: - (import (ice-9 streams) (ice-9 rdelim)) (define (port->line-stream port handle-delim) (port->stream port (lambda (port) (read-line port handle-del

Re: I/O, modules

2012-11-13 Thread Mike Gran
> From: Mark H Weaver > > As shown in the upcase program above, (read-delimited "" port) will > read > the whole file as a string.  You need to (use-modules (ice-9 rdelim)) to > import this procedure. Nice.  For reading entire files, I always ended up doing something like the following (which

Re: I/O, modules

2012-11-13 Thread Mark H Weaver
thorso...@lavabit.com writes: > Could you show me some trivial programs related to I/O (e.g. read from > file, convert to uppercase, write to another file)? There are many ways to do this, but here's a simple upcase program that reads the entire file into memory and does not depend on any external

Re: I/O, modules

2012-11-13 Thread Thien-Thi Nguyen
() thorso...@lavabit.com () Tue, 13 Nov 2012 00:57:11 -0500 (EST) [...] to read the whole file at once. Should I import some module to get the above functions? Which one? Personally, i would do: -*- mode: compilation; default-directory: "/tmp/" -*- Compilation started at Tue Nov 13 10:04:0

Re: I/O, modules

2012-11-13 Thread Ludovic Courtès
Hi, thorso...@lavabit.com skribis: > Could you show me some trivial programs related to I/O (e.g. read from > file, convert to uppercase, write to another file)? > > This page [0] doesn't list a function that can be used to read the whole > file at once. Is there a "read-string" function? What ab

I/O, modules

2012-11-12 Thread thorsopia
Hello, Could you show me some trivial programs related to I/O (e.g. read from file, convert to uppercase, write to another file)? This page [0] doesn't list a function that can be used to read the whole file at once. Is there a "read-string" function? What about "read-port"? Should I import some