[plt-scheme] how to specify the language "PLAI Scheme" in PLT Scheme in Emacs

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Mar 4 06:32:57 EST 2009

I think you've become rather confused, but that this confusion can be
rather simply cleared up.

PLT Scheme supports multiple languages. You specify the language you
are using (in v4 PLT) with the line

  #lang whatever

at the top of your file. E.g.

  #lang scheme         => I'm using scheme (lots of stuff included)
  #lang scheme/base => I'm using the scheme/base language (like scheme
but less stuff)
  #lang web-server    => I'm using the stateless web server language

There are two things called mzscheme:

1. The command line interpreter
2. A language the mimics the v3 scheme language

So

  #lang mzscheme  => I'm a dinosaur, using the v3 compatibility language

The PLAI docs say:

 "These languages are also available as the module languages plai,
plai/collector, plai/mutator and plai/web respectively."

So

  #lang plai               => I'm using PLAI
  #lang plai/collector => I'm using the PLAI GC language

etc.

This is how you use these languages in your code. Now to use the
languages in the REPL you have to do something a little bit different.
Basically, you run mzscheme with the -I switch, specifying the module
that implements the language you want to use. E.g.:

  noel at Quixotic~> mzscheme -I lang/htdp-beginner.ss

This runs mzscheme with the HtDP beginner language. Notice how the
interactions are constrained:

  Welcome to MzScheme v4.1.3.8 [3m], Copyright (c) 2004-2008 PLT Scheme Inc.
  > (define (foo x) (x 1))
  stdin::8: define: function definitions are not allowed in the
interactions window; they must be in the definitions window in:
(define (foo x) (x 1))

Not all languages can be run this way; some only work with DrScheme. I
don't know what the deal for the PLAI languages is, but probably

  mzscheme -I plai/lang.ss

will work.

HTH,
Noel

On Wed, Mar 4, 2009 at 9:54 AM, Benjamin L. Russell
<DekuDekuplex at yahoo.com> wrote:

> According to the online documentation for MzScheme for the CS173
> course associated with PLAI (see "MzScheme: Legacy Module Language" at
> http://www.cs.brown.edu/courses/cs173/2008/Manual/mzscheme/index.html),
> the documentation refers to "the mzscheme language," implying that
> MzScheme is a separate language from "PLAI Scheme," and not just a
> command-line tool equipped with the same languages.
>
> Furthermore, according to the online documentation for the software
> accompanying PLAI (see the "Programming Languages: Application and
> Interpretation" section of the "PLT Scheme (installation)" manual at
> http://www.cs.brown.edu/courses/cs173/2008/Manual/manual/index.html),
> choosing the language in DrScheme is described, but choosing the
> language in MzScheme in Emacs is not.
>
> Is there any way to specify the language "PLAI Scheme" when working
> with a PLT Scheme REPL in Emacs?
>
> -- Benjamin L. Russell


Posted on the users mailing list.