[plt-scheme] Re: question about "module: initial import not well formed"

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Mar 18 06:43:03 EDT 2008

On Mar 18, Rohan Drape wrote:
>  i think by 'official' i meant rather an explanation in the manual
>  of how to resolve name conflicts with the standard language
>  modules.  since scheme/base defines a lot of names this is perhaps
>  a common issue?

The thing is that (PLT) Scheme is way more flexible than other
languages, which makes `emptiness' a questionable concept.  My version
was empty to an extreme, for example, the equivalent example using
prefixes as show in:

>  (perhaps something along the lines of:
>  http://haskell.org/onlinereport/modules.html#sect5.3.2)

uses many `#%app's etc -- and if you want to give them new names you
can, but it makes the code much more verbose:

  (module x2 "empty.ss"
    (#%require (only scheme/base require only-in prefix-in))
    (require (prefix-in scheme.
                        (only-in scheme
                                 #%app #%datum provide define lambda + printf)))
    (scheme.provide succ)
    (scheme.define succ
      (scheme.lambda (n) (scheme.#%app scheme.+ n (scheme.#%datum . 1))))

    (scheme.#%app scheme.printf (scheme.#%datum . ">>> ~s\n")
                  (scheme.#%app succ (scheme.#%datum . 7))))

>  (also, one could hopefully write a lot of scheme without
>  encountering  #%require #%app #%top #%datum and
>  #%module-begin.)

Not really -- but they appear implicitly which is why you usually
don't care about them.  They're really useful when you want to change
the semantics of the language in a very fundamental way.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.