[R6RS] libraries

dyb at cs.indiana.edu dyb
Sat Dec 10 18:24:13 EST 2005


> > is acceptable, right?  What about:
> >
> >   (library S "scheme://r6rs"
> >     (export P!)
> >     (define s '())
> >     (define-syntax P!
> >       (syntax-rules ()
> >         [(_ y) (set! s (cons y s))]))
> >   (library T "scheme://r6rs"
> >     (import S)
> >     (export P0!)
> >     (define (P0!) (P! 0)))
> >
> > The set! to s appears in the body of S, so by a literal reading of your
> > response, it should be okay.
>
> Yes, this should also be acceptable.

Oops.  That's not even valid, since the parens are mismatched and it's
missing the export for s.  What I meant was this:

  (library S "scheme://r6rs"
    (export P! s)
    (define s '())
    (define-syntax P!
      (syntax-rules ()
        [(_ y) (set! s (cons y s))])))
  (library T "scheme://r6rs"
    (import S)
    (export P0!)
    (define (P0!) (P! 0)))

I'll assume that the fixed version is okay.

Presumably the following is okay as well, right?

  (library S "scheme://r6rs"
    (export P1! P2! s)
    (define s '())
    (define-syntax P1!
      (syntax-rules ()
        [(_ x y) (set! x (cons y x))]))
    (define-syntax P2!
      (syntax-rules ()
        [(_ y) (P1! s y)])))
  (library T "scheme://r6rs"
    (import S)
    (export P0!)
    (define (P0!) (P2! 0)))

What about:

  (library S "scheme://r6rs"
    (export P! s)
    (define s '())
    (define-syntax P!
      (syntax-rules ()
        [(_ x y) (set! x (cons y x))])))
  (library T "scheme://r6rs"
    (import S)
    (export P0!)
    (define (P0!) (P! s 0)))

Is this okay too?  The set! is contained within S.

Kent


More information about the R6RS mailing list