From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.lisp.guile.user Subject: How to read from a file Date: Fri, 18 Jun 2010 16:31:38 +0200 Organization: Decebal Computing Message-ID: <878w6ccsz9.fsf@linux-lqcw.site> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1276871544 16340 80.91.229.12 (18 Jun 2010 14:32:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2010 14:32:24 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jun 18 16:32:23 2010 connect(): No such file or directory Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OPccI-0006Ll-0w for guile-user@m.gmane.org; Fri, 18 Jun 2010 16:32:22 +0200 Original-Received: from localhost ([127.0.0.1]:60429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPccG-0004ds-EO for guile-user@m.gmane.org; Fri, 18 Jun 2010 10:32:20 -0400 Original-Received: from [140.186.70.92] (port=59237 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPccA-0004al-BJ for guile-user@gnu.org; Fri, 18 Jun 2010 10:32:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPcb1-0001vU-Dy for guile-user@gnu.org; Fri, 18 Jun 2010 10:31:04 -0400 Original-Received: from smtp-vbr7.xs4all.nl ([194.109.24.27]:4213) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPcb1-0001vD-6u for guile-user@gnu.org; Fri, 18 Jun 2010 10:31:03 -0400 Original-Received: from linux-lqcw.site (84-53-123-169.wxdsl.nl [84.53.123.169]) by smtp-vbr7.xs4all.nl (8.13.8/8.13.8) with ESMTP id o5IEV1Ca097891 for ; Fri, 18 Jun 2010 16:31:01 +0200 (CEST) (envelope-from Cecil@decebal.nl) X-Homepage: http://www.decebal.nl/ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-Virus-Scanned: by XS4ALL Virus Scanner X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7894 Archived-At: When looking at: http://www.gnu.org/software/guile/docs/faq/OLD-guile-faq.html The following code should work: #!/usr/bin/guile \ -e main -s !# (use-modules (ice-9 readline)) (activate-readline) (define (main args) (let ((input-file (cadr args)) (output-file (caddr args))) (with-input-from-file input-file (lambda () (while (not (eof-object? (peek-char))) (display (read-line)) (newline)))))) But when executing it, I get: ERROR: Unbound variable: read-line What am I doing wrong? Also, it says: guile's IO performance is not very fast at the moment, so if you have to process large files, you may want to use a different model What would be a more efficient way to process a file? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof