[racket] Getting started with R6RS

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat May 14 09:34:24 EDT 2011

On Sat, May 14, 2011 at 9:26 AM, Elliott Cable <me at ell.io> wrote:
> Both of you misunderstood. A) I don’t use DrRacket (partially because
> I’m working on the Lion developer privew, and DrRacket won’t build
> there; and partially because I have an inbuilt disrespect for
> graphical IDEs.) and B) I’ve already read all of the documentation you
> linked to; that’s exactly where I’m finding information like
> `#%module-begin`. It’s extremely unclear how to use that directive.

You shouldn't use `#%module-begin' at all -- it's a part of the
implementation of R6RS in Racket.

> Anyway, to rephrase my original question so it’s more clear: `#!r6rs`,
> and the expansion of that, `(module foo r6rs … )`, combined with
> `(#%module-begin … )`, is causing a syntactic error when I try to use
> two `(#%moduleb-begin … )`s in the same file (and thus in the same
> Racket `(module … )` decaration, since it doesn’t seem Racket will
> allow two `(module … )` declarations in a given file.) The goal here,
> just to get started with something simple, was to declare both a
> simple R6RS library, and an R6RS “top-level program,” and have that
> top-level program consume the library in some way. Simple stuff, just
> to experiment as I am reading the R6RS spec and learning.

1. You won't be able to put these in a single file and have it work.
That's probably what's causing your problem.  The R6RS doesn't specify
how libraries and top-level programs map to the file system.  In
Racket, each R6RS library and each top-level program should be in a
separate file.

2. To create a library that you can refer to from a top-level program,
see the documentation here:
sam th
samth at ccs.neu.edu

Posted on the users mailing list.