Hello, I had encountered interesting thing yesterday, which challenged my understanding of guile (scheme). I always assumed that order of definitions in scheme does not matter, as long as everything if defined when it is running. So this should (and does) work: (define (x) (y)) (define (y) (display "foo\n")) (x) However, then I wanted to used SRFI-9. I did use similar pattern, and it failed. The test code for that is: (use-modules (srfi srfi-9)) (define (x y) (display (foo y)) (newline)) (define-record-type q (make-q foo) q? (foo foo)) (x (make-q "1")) The error I got was: Backtrace: In ice-9/boot-9.scm: 1752:10 7 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 6 (apply-smob/0 #) In ice-9/boot-9.scm: 724:2 5 (call-with-prompt ("prompt") # …) In ice-9/eval.scm: 619:8 4 (_ #(#(#))) In ice-9/boot-9.scm: 2836:4 3 (save-module-excursion #) 4388:12 2 (_) In /tmp/q/srfi-9.scm: 4:11 1 (x _) 4:11 0 (x _) /tmp/q/srfi-9.scm:4:11: In procedure x: Wrong type to apply: # When I move the (define-record-type ...) call above (define (x...) it starts to works. Also, I could not help to notice that when I use R6RS records it does work regardless of the order: (use-modules (rnrs records syntactic)) (define (x y) (display (q-foo y)) (newline)) (define-record-type q (fields foo)) (x (make-q "1")) So, I have few questions I would like to ask: 1. When does order matter? What is going on here? 2. Why does guile recommend SRFI-9 over the R6RS records? They seem less verbose and more robust. At least to novice like me. 3. What does guile implement by default? There are --r6rs and --r7rs arguments, what scheme is used when neither is supplied? R5RS? Sorry if this is stupid question, the scheme landscape seems... complicated. 4. Is the (install-r6rs!) global and affecting all reading from that point on or is it scoped to the file being currently read? I ask because I am curious if I can mix files using R6RS and R7RS in one program. Thank you very much, W. -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.