[racket] Getting started with R6RS

From: Elliott Cable (me at ell.io)
Date: Sat May 14 07:16:13 EDT 2011

I’m new to both Racket and Scheme; I’ve been reading through the R6RS,
and I’m trying to get started with some simple code.

Unfortunately, I’m having trouble with Racket’s R6RS syntax/supporting
features; what, exactly, is `(#%module-begin)` supposed to do? How am
I supposed to properly use it? From the way I read it, I’m supposed to
wrap every R6RS “library” and “top-level program” individually in a
Racket `(#%module-begin)` to make Racket capable of understanding the
R6RS content?

Here’s what I was getting started with, and thus the code I can’t seem
to get working. I get an error that it’s expecting an `(import)`
instead of an `(export)`, which seems to me that it would source from
Racket thinking it’s looking at an R6RS top-level program instead of a
library (where `(export)` *would* be illegal syntax):
https://gist.github.com/972114

The error I’m getting is thus:

some-r6rs.rkt:1:22: top-level-program: expected an `import'
declaration, found something else in: (#%module-begin (library
(wheeeee (1 1)) (export run) (import (library (rnrs base (6))))
(define (run a) (printf "running!\n"))))



Posted on the users mailing list.