Tobias Brandt <tob.bra...@googlemail.com> writes: > Declaring a R6RS style library doesn't work: > > (library (foo)) > > => > ice-9/psyntax.scm:1422:30: In procedure expand-macro: > ice-9/psyntax.scm:1422:30: Syntax error: > source expression failed to match any pattern in form (library (foo)) > > > while this does: > > (define-module (foo))
This is a misunderstanding on your part, I'm afraid. R6RS library forms are intended to wrap the code[0]; they are not declarations to be placed at the top. The manual does mention this[1], by noting the syntax for library is (library name (export export-spec ...) (import import-spec ...) body ...) Without an example, I can see how the equivalence mentioned at the top may be misleading. Perhaps the manual should add an example? Even something as simple as, say (library (counters) (export make-counter) (import (rnrs base) (define (make-counter start) (lambda () (let ((val start)) (set! start (+ start 1)) val))) ) would probably be helpful. 0. http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-10.html 1. http://www.gnu.org/software/guile/manual/html_node/R6RS-Libraries.html -- Ian Price "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"