Guide to ML assignments

This guide is to help you get used to using the ML interpreter for your homework assignments. First I'll give some general advice on the easiest way to work. Then I'll explain what you need to know or do depending on where you choose to work-- both what platform you prefer and what lab you choose to work in.

The game of the name

In addition to "ML", you will sometimes see the name "SML." The "S" is for "Standard," so this indicates a particular variety of ML. Since SML is the version of ML we're using, "SML" and "ML" are synonymous for our purposes. You also may see "SMLNJ" or "SML/NJ", which stands for "Standard ML of New Jersey." This refers to the implementation of SML that we're using. It was developed (initially) at Princeton University and Bell Labs; use your geographic knowledge to figure out how it got its name.

General working procedures

Since you will usually need to make corrections to your code as you go along, and since you will always want to turn in your completed code, you will want to have two windows open. First, you need the ML interpreter window; second, you should have a text editor window. Use the text editor to write the code. When you think it's right, copy and paste it into the ML interpreter. If you get an error, then make some corrections in the text editor and try again. Use the text editor to save your work to a file. Finally, print out the file from the text editor or email the file to your TA.

Platform specific information

Linux and other UNIX. Xemacs has a mode for a language called CaML, which is related to ML. If you open a file with the extension .ml, Xemacs will automatically start in that mode. It should help you make your ML programs nice and pretty. Emacs and Vim might provide support as well, but being an Xemacs partisan, I wouldn't know. Don't forget that to copy and paste, all you need to do is highlight the text and then middle-click into the window where you want to paste.

Macintosh. If you're not familiar with "text editors", it just refers to a program that's similar to a word processor, but a lot simpler. The standard one that comes with MacOS is called "TextEdit", and you should find it under "Applications" on your computer. Copying and pasting between the two programs shouldn't be too hard---it's a Mac, after all.

Windows. The standard text editor in Windows is NotePad. Copying and pasting between NotePad and SML is a bit tricky: Highlight in NotePad and copy it as you normally would (either from the Edit menu or using shortcut keys); then right-click in the ML window and select "paste." If you ever need to copy and paste from the interpreter to NotePad, then right-click in the interpreter window and select "mark"; drag over the code you want to copy; press enter; and then paste into NotePad.

Where to work

CS Lab. The CS Lab (Armerding 131) is the obvious place to work, at least for CS majors. Accounts in the CS Lab are limited to people enrolled in a CS course-- but that includes all of you. Math people, CS people, and others are welcome. If you've had a class in the CS Lab before, this is what you'll probably prefer.

The command to start the interpreter is sml. This will start the interpreter running in the terminal window. You also have access to code from the chapter and from class. The code we use on September 5, for example, will be found in /homes/tvandrun/Public/cs243/sept5.ml.

SciLab. ML is installed in SciLab (Armerding 128). You'll find it under "Departmental Programs," "Computer Science," "smlnj."

At home. Alternately, you can install the ML interpreter on your own computer. SML/NJ is freely available for download for Linux/Unix, Macintosh, and Windows. See www.smlnj.org.


Thomas VanDrunen
Last modified: Thu Aug 28 16:41:30 CDT 2008