El mar, 13-11-2012 a las 10:46 +0800, Daniel Hartwig escribió:
>
> However, trying to call with three arguments then triggers an error,
> and I am not sure why:
>
> scheme@(guile-user)> (g 1 2 3)
> :46:1: In procedure g:
> :46:1: In procedure # #:key x)>: Invalid keyword
>
> Entering a new promp
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
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
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
> 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
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
() 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
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