[gambit-list] Using a function in a macro

Benjohn Barnes benjohn at fysh.org
Mon Jun 20 08:43:22 EDT 2011


On 19 Jun 2011, at 23:04, Per Eckerdal wrote:

*snip*

> The way to do this in Black Hole is to separate the code that is needed at compile time into a separate module. Here's a Black Hole version of your example:
> 
> t[master]$ cat > inc.scm 
> (define (inc x) (+ 1 x))
> 
> t[master]$ cat > example.scm 
> (syntax-begin (import inc))
> (import inc)
> (define-macro (macro-inc x) (inc x))
> (define two (inc 1))
> (define macro-two (macro-inc 1))
> 
> t[master]$ bsc
> Loaded Black Hole.
> Gambit v4.6.1
> 
> > (import example)
> > two
> 2
> > macro-two
> 2

*snip*

Thank you Per, that works! Great stuff.

Also, thank you Mark for the solution in vanilla Gambit.


-- 
benjohn at fysh.org - Twitter @benjohnbarnes - Skype benjohnbarnes - Mobile +44 (0) 7968 851 636




More information about the Gambit-list mailing list