[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to read from a file
From: |
Mike Gran |
Subject: |
Re: How to read from a file |
Date: |
Fri, 18 Jun 2010 08:50:28 -0700 (PDT) |
> From: Cecil Westerhof address@hidden
What am I doing wrong?
You're confusing (ice-9 readline) with (ice-9 rdelim).
The former adds the ability to edit from the guile prompt.
The latter adds a function to read whole lines from
ports.
I might have written your script this way
(use-modules (ice-9 rdelim))
(define (main args)
(let ((input-file (cadr args))
(output-file (caddr args)))
(with-input-from-file input-file
(lambda ()
(let loop ((line (read-line)))
(cond ((not (eof-object? line))
(display line)
(newline)
(loop (read-line)))))))))
-Mike