[plt-scheme] Porting to R6RS -- define-struct

From: Jon Simons (simonsj at ccs.neu.edu)
Date: Tue Jul 1 05:16:06 EDT 2008


I am trying to port a pet project of mine from something that works with
mzscheme v372 to be R6RS-compliant.  My project had a few modules in
different files within a local directory, and my top level file had a
series of:

   (require (lib "list.ss"))
   (require "foo.scm")  ;; local module
   (require "bar.scm")  ;; local module

So far I've managed to accomplish:

   (import (rnrs)

Where my 'foo' module used to be:

   (module foo mzscheme
     (require (lib "list.ss"))
     (provide foo-func))

And is now:

   (library (foo)
            (export foo-func)
            (import (rnrs)
                    (rnrs lists (6)))

     #| foo-func definition |#)

So far, so good... I used 'plt-r6rs --install ./foo.scm' to install my
local file as an R6RS library.  Is this the proper thing to do, even if
this module is solely intended for use within my program?

Now onto my 'bar' module.  This module uses define-struct, and I 
currently have something like:

   (library (bar)
            (export BAR)

     (define-struct BAR (a b c)))

This yields "export: no binding for exported identifier in: BAR".  I'm
guessing that I need to import something to make define-struct available
so that it can provide the BAR identifier.

My question is -- how do I make this "work" ?  Is define-struct 
available in an R6RS-friendly manner?

Jon Simons

Posted on the users mailing list.