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 about "read-port"? For textual I/O, search the manual for (ice-9 rdelim). This module provides a ‘read-line’ function, which reads a line from a port. For binary I/O, search for (rnrs io ports). You’ll get a variety of procedures, including ‘get-bytevector-all’, which reads all of a ports contents in memory. > I created two files in the same dir: > > test-scm.scm: > > (define-module (test-scm) > #:export (test-func)) > > (define (test-func x) > (+ x 1)) > > import-test.scm: > > (define-module (import-test) > #:use-module (test-scm)) > > (display (test-func 2)) > > Why does "guile import-test.scm" raise "ERROR: no code for module > (test-scm)"? Because ‘test-scm.scm’ is not in the search path. The fix is to run: guile -L . import-test.scm Thanks, Ludo’.