[gambit-list] What's in your gambc.scm file?
feeley at iro.umontreal.ca
Thu Oct 1 08:17:14 EDT 2009
On 1-Oct-09, at 7:57 AM, Nicola Archibald wrote:
> On 01/10/2009 12:51 PM, Robert H wrote:
>> I was just perusing the "Teach yourself Scheme in fixnum days"
>> and came across the gambc.scm init section. The tutorial doesn't go
>> examples of what that file is so I thought I might ask what you all
>> in the init file.
> 'wrong' is what it is... (At least today)
> A 20 second experiment, and subsequent strace run, reveals that it
> should be ~/.gambcini.scm not ~/gambc.scm.
> As for what I have in it (heh), nothing, as I wasn't aware of it
> either :)
~/.gambcini.scm is where you should put any commands or definitions
(macros or procedures) which you want to have access to from the REPL
and other loaded code.
For example, if you want to be able to use syntax-case with no other
incantations to gsi then put this in your .gambcini.scm file:
(println "loading ~/.gambcini.scm")
If you are a Common Lisp fan and you would like to use "defun" to
(define-macro (defun name params . body)
`(define ,name (lambda ,params , at body)))
[note that macros defined in .gambcini.scm are available in the REPL
and programs loaded from the REPL]
If you constantly need "fib" then add:
(defun fib (n)
(if (< n 2)
(+ (fib (- n 1))
(fib (- n 2)))))
More information about the Gambit-list