[gambit-list] Macros, separate files, and all that

Bradley Lucier lucier at math.purdue.edu
Thu Jan 31 13:38:45 EST 2013


Marc:

Assume that there's a file called "streams.scm" that has Phil Bewig's streams code in it, and that there's a file called "sieve.scm" that uses the definitions in streams.scm

Now, when I do

[Media-Mac-mini-3:~/Downloads] lucier% gsi -:s
Gambit v4.6.6

> (load "streams.scm")
"/Users/lucier/Downloads/streams.scm"
> (load "sieve.scm")
"/Users/lucier/Downloads/sieve.scm"
> (stream->list 10 primes) 
(2 3 5 7 11 13 17 19 23 29)

everything works fine.  But if I compile the streams code and do

[Media-Mac-mini-3:~/Downloads] lucier% gsi -:s
Gambit v4.6.6

> (load "streams")
"/Users/lucier/Downloads/streams.o3"
> (load "sieve.scm")
*** ERROR IN #<procedure #2>, "sieve.scm"@5.6 -- Unbound variable: define-stream

then, as you can see, a macro from streams.o3 is not available for use in expanding sieve.scm.

So, I guess I don't understand the "persistence" or whatever you would call it of R5RS macros, and how that interacts with Gambit's compilation model.

Can you help?

Brad


More information about the Gambit-list mailing list