On Thursday, June 11, 2015 at 4:22:19 PM UTC-4, John Carmack wrote:
> How do you include a racket module in an R6RS program?
> 
>  
> 
> I have remote.rkt in the same directory as test.scm.
> 
>  
> 
> With R5RS I could do (#%require "remote.rkt"), but that doesn’t work, and I 
> tried various things in the (import) statement without success.
> 
>  
> 
> Are there any plans for an R7RS lang in Racket?  I am trying to write code 
> that runs in both DrRacket and Chibi scheme.
> 
>  
> 
>  

I managed to get something working:

The Racket r5rs documentation states that the `#%require` form is provided from 
racket/base. Since typing `#%require` raises (as far as I've experienced) an 
"illegal character after '#' input: '%'" error, I had to fall back onto the 
standard `require` form:

remote.rkt:

#lang racket
(provide foo)

(define (foo x) (add1 x))


test.scm:

#!r6rs
(import (rnrs)
        (only (racket base) require))
(require "remote.rkt")
(display (foo 2))


It's not an "r6rs-pure" solution, unfortunately, but, as mflatt said, there's 
no real way do this in pure r6rs. I don't know your use case, but this might 
work for you.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to