views:

81

answers:

1

Hi ! I'm struck on a problem with a simple scheme application. In one file (dataloader.ss), I define a struct :

(define-struct book-category (id name books))

But I can't use the structure in another file. What I try is, in dataloader.ss, to export the structure with

(provide book-category)

And in the other file, I import :

(require "dataloader.ss").

But a call to one of the struct functions irremediably fails : For example

(make-book-category 2 "test" '())

gives me :

reference to an identifier before its definition: make-book-category

On the other hand, if I redefine the struct in the 2nd file, it tells me : "module: identifier is already imported in: book-category" so, I guess the import works at least partially. But I still can't access the associated functions. Is there something else to do?

Thanks in advance!

+1  A: 

Ok found it, i must export with the struct-out keyword, as in

(provide  (struct-out book-category))
Eino Gourdin