[gambcini and install docs updated atsmyles@earthlink.net**20090314223100] hunk ./docs/install.html 14 -

You can use this one which will save all your libraries into "~/.gambit/lib"

+

The gambcini file included in the distribution has an implementation of this procedure as well as friendly procedures for loading the base r6rs library and a macro for running programs so you can create a script like the following

hunk ./docs/install.html 16 - -(define (library->filename name) - (define library-path "~/.gambit/lib") - (define (name->string name delim) - (cond - ((and (pair? name) (null? (cdr name))) (name->string (car name) "")) - ((pair? name) (string-append (name->string (car name) "") delim (name->string (cdr name) delim))) - ((number? name) (number->string name)) - ((symbol? name) (symbol->string name)))) - (define (name&version name) - (cond - ((and (symbol? (car name)) (pair? (cdr name))) - (call-with-values - (lambda () (name&version (cdr name))) - (lambda (n v) (values (cons (car name) n) v)))) - ((and (symbol? (car name)) (null? (cdr name))) (values name '())) - ((pair? (car name)) (values '() (car name))))) - - (call-with-values - (lambda () (name&version name)) - (lambda (n v) - (path-expand - (if (pair? v) - ;TODO make versioning work - ;(string-append (name->string n "-") "." (name->string v "")) - (string-append (name->string n "-") ".o1") - (string-append (name->string n "-") ".o1")) - library-path)))) - +(r6rs) +(program () + (import (r5rs)) + (display "Hello World!\n")) + addfile ./gambcini hunk ./gambcini 1 +; vim: syntax=scheme +(define R6RS-LIBRARIES "~/.gambit/lib") + +(define (r6rs) (load (path-expand "r6rs.o1" R6RS-LIBRARIES))) + +(define (library->filename name) + (define (name->string name delim) + (cond + ((and (pair? name) (null? (cdr name))) (name->string (car name) "")) + ((pair? name) (string-append (name->string (car name) "") delim (name->string (cdr name) delim))) + ((number? name) (number->string name)) + ((symbol? name) (symbol->string name)))) + (define (name&version name) + (cond + ((and (symbol? (car name)) (pair? (cdr name))) + (call-with-values + (lambda () (name&version (cdr name))) + (lambda (n v) (values (cons (car name) n) v)))) + ((and (symbol? (car name)) (null? (cdr name))) (values name '())) + ((pair? (car name)) (values '() (car name))))) + + (call-with-values + (lambda () (name&version name)) + (lambda (n v) + (path-expand + (if (pair? v) + ;TODO make versioning work + ;(string-append (name->string n "-") "." (name->string v "")) + (string-append (name->string n "-") ".o1") + (string-append (name->string n "-") ".o1")) + R6RS-LIBRARIES)))) + +(define-macro (program options . body) + (cond + ((null? options) `(ex:run-r6rs-sequence ',body)) + ((or (memq 'repl options) + (memq 'interactive options)) `(ex:repl ',body)) + (else (assertion-violation 'program "unknown options" options))))