[plt-scheme] Scheme from the commandline

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 26 03:18:55 EDT 2007

At Mon, 26 Mar 2007 02:00:21 -0500, Don Blaheta wrote:
> I'm trying to write scripts to automate a couple things, and I've run
> into two problems.  My students are using DrScheme v360 and are (at the
> moment) in Beginner Student.
> 
> * I tried to automatically load their files using mzscheme -f.  I can
>   set the language level, but when I run this:
> 
>     mzscheme -L htdp-beginner.ss lang -f hwk1.scm
> 
>   I get this message:
> 
>     hwk1.scm:26:0: define: function definitions are not allowed in the
>     interactions window; they must be in the definitions window in: ...
> 
>   As a workaround I can just load them inside intermediate, but I'm
>   still curious: is there a better way?

You should wrap the program in a `module', like this:

    (let ([src (read-all ...)])
       `(module foo (lib "htdp-beginner.ss" "lang") , at src))

where `read-all' reads all expressions from the source file and
produces a list of them.

The next version of DrScheme saves teaching-language programs with the
`module' wrapper, so this will be a little easier in the future.

> * Some of them have been making use of the graphical Test Case boxes,
>   and their files are thus in the WXME multimedia format.  I gather that
>   this isn't part of (the release version of) mzscheme yet, but I thought
>   it was in MrEd; but when I try
> 
>     mred -z -L htdp-intermediate.ss lang -f hwk1.scm
> 
>   I get
> 
>     Unknown snip class or version: "test-case-box%" version 2.
> 
>   That actually sounds like it's recognising the format, but isn't
>   test-case-box% a builtin snip type?  The file opens in the current
>   version of DrScheme just fine.

The test case boxes never properly registered themselves. It works in
DrScheme because DrScheme manually loads the text-case-box snip class
on startup.

>  Could I just skip these (since I'll
>   be running my own tests as part of a script anyway)?

The easiest way to skip them may be to use the new "wxme" library
in a nightly build:

   http://pre.plt-scheme.org/installers/

Of course, you wouldn't want students to use that version, but it might
be easiest to use it yourself to automate things.

Matthew



Posted on the users mailing list.