9 # ln -s module/{system,language} /usr/local/share/guile/site/
11 Add the following lines to your ~/.guile:
13 (if (string=? (car (command-line)) "guile-vm")
15 (use-modules (system repl repl))
23 Standard Scheme (R5RS + syntax-case) interpreter 0.3 on Guile 1.4.1
24 Copyright (C) 2001 Free Software Foundation, Inc.
26 Enter `,help' for help.
29 r5rs@guile> ,c -c (+ 1 2) ;; Compile into GLIL
35 r5rs@guile> ,c -l (+ 1 2) ;; Compile into loadable code
47 r5rs@guile> ,c (+ 1 2) ;; Compile and disassemble
48 Disassembly of #<program 0x810f75b>:
50 args = 0 rest = 0 locals = 0
59 r5rs@guile> (define (add x y) (+ x y))
62 r5rs@guile> ,x add ;; Disassemble
63 Disassembly of #<program 0x8125f70>:
65 args = 2 rest = 0 locals = 0
79 ---- fib.scm ---------------------------
81 :use-module (system vm load)
84 (load/compile "fib.gsm")
85 ----------------------------------------
87 ---- fib.gsm ---------------------------
91 (+ (fib (- n 1)) (fib (- n 2)))))
92 ----------------------------------------
94 Now, expressions in fib.gsm are automatically compiled and
95 executed by the Guile VM:
98 guile> (use-modules (fib))
99 guile> (time (fib 30))
100 clock utime stime cutime cstime gctime
101 2.89 2.88 0.00 0.00 0.00 0.00
103 guile> (define (fib n) (if (< n 2) 1 (+ (fib (- n 1)) (fib (- n 2)))))
104 guile> (time (fib 30))
105 clock utime stime cutime cstime gctime
106 26.05 25.01 0.17 0.00 0.00 14.33
109 If you don't want to compile your code (e.g., for debugging purpose),
110 just change `load/compile' to `load'.