<div><br></div><div class="gmail_quote">2011/5/14 Elliott Cable <span dir="ltr">&lt;<a href="mailto:me@ell.io">me@ell.io</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I’m new to both Racket and Scheme; I’ve been reading through the R6RS,<br>
and I’m trying to get started with some simple code.<br>
<br>
Unfortunately, I’m having trouble with Racket’s R6RS syntax/supporting<br>
features; what, exactly, is `(#%module-begin)` supposed to do? How am<br>
I supposed to properly use it? From the way I read it, I’m supposed to<br>
wrap every R6RS “library” and “top-level program” individually in a<br>
Racket `(#%module-begin)` to make Racket capable of understanding the<br>
R6RS content?<br>
<br>
Here’s what I was getting started with, and thus the code I can’t seem<br>
to get working. I get an error that it’s expecting an `(import)`<br>
instead of an `(export)`, which seems to me that it would source from<br>
Racket thinking it’s looking at an R6RS top-level program instead of a<br>
library (where `(export)` *would* be illegal syntax):<br>
<a href="https://gist.github.com/972114" target="_blank">https://gist.github.com/972114</a><br>
<br>
The error I’m getting is thus:<br>
<br>
some-r6rs.rkt:1:22: top-level-program: expected an `import&#39;<br>
declaration, found something else in: (#%module-begin (library<br>
(wheeeee (1 1)) (export run) (import (library (rnrs base (6))))<br>
(define (run a) (printf &quot;running!\n&quot;))))<br><br></blockquote><div><br></div><div>I don&#39;t think it&#39;s a great idea to start with R6RS, it has not gained a lot of acceptance, so its advantages against the Racket language is mostly theoretical.</div>
<div><br></div><div>That said, here&#39;s a simple R&amp;RS program:</div><div><br></div><div><div>#!r6rs</div><div><br></div><div>(import (library (rnrs base (6)))</div><div>        (library (rnrs io simple (6))))</div><div>
<br></div><div>(display</div><div> (+ 2 2))</div></div><div><br></div><div><br></div></div>