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 whether you want to work in the lab or on your own computer.
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---since both of those are in New Jersey, that's how the software got its name.
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.
You can do your work either in the computer science lab (SCI 154), one of the math project rooms (SCI 168 and SCI 182), or your own computer. The advantage of working in the CS lab is that you can learn from your classmates who are there working with you (that would require you to learn to use Ubuntu, the operating system the CS lab machines run... it's not too hard, though.)
In the CS lab
The computers in the CS lab are running Ubuntu (a variety of Linux). If you haven't used Ubuntu or a similar platform before, it shouldn't be to hard to figure enough out in order to be able to do what you need for this class. From the menu at the top of the screen you can get a web browser by going to Applications -> Internet -> Firefox or Applications -> Internet -> Google Chrome.
To run ML, open a terminal by going to Applications -> Accessories -> Terminal, and in the terminal window type "sml". You can get a text editor by going to Applications -> Accessories -> GEdit Text Editor. If you need help or just want to know more, there are plenty of friendly people who hang out in the lab whom you could ask.
Alternately, if you want to avoid using Ubuntu as much as possible, then after you log in, you can go to Applications -> Accessories -> Virtual Box OSE. This will launch a program that acts as a virtual computer running Windows XP. You will find the ML interpreter in the Start menu under Departmental Programs -> Computer Science -> smlnj.
In the math project rooms
The math department has a couple of "project rooms" that can be used as computer labs. The computers in SCI 182 and SCI 168 are running Windows XP and they have ML installed. You can findi t under All Programs -> Math Programs -> SML of New Jersey.
At home.
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 for the software homepage or http://www.smlnj.org/dist/working/110.73/index.html for the downloads page.
If you are downloading it to use on a Mac, there may be one last step you need to do after it installs. Details:
The installer will put the binary for sml some place that is not in your path. In order to get SML in the command line, you will either need to change your PATH environment variable to include the directory for SML binaries (something like/usr/local/smlnj-110.73/bin
) or make a symbolic link to the appropriat e binary from something already in your path (for example, doln -s /usr/local/smlnj-110.73/bin/smlnj
in your/usr/local/bin
folder.)
If you don't know what that paragraph was about, then stop by my office and it will take me 5 seconds to fix up your computer.
Linux and other UNIX. GEdit and Xemacs have modes for a language called Objective CaML, which is related to ML. These should help you make your ML programs nice and pretty. 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.
If you would like to work on your own computer but are unable to install the software, one solution is to logon to the lab from your computer.
Macintosh. On a Mac, you can log into the machines in the cslab using a program called "ssh" from the Terminal window. You can find the Terminal under Finder->Applications->Utilities->Terminal. If you find that you prefer working this way, you'll probably want to put a shortcut to Terminal in your dock. If you are on campus, then you can log into a cslab machine by typing "ssh (your id)@(name of cslab machine)". The machines in the cslab are named "cslab01" through "cslab25". You may use any of them. For example:
ssh tvandrun@cslab05
The first time you do this you'll get warning about "Permanently added the RSA host blah blah blah." Don't worry about that.
Once you are on a lab machine, you can run the ML interpreter by just typing "sml", as you would if you were in the lab.
If you are doing this off campus, this will take two steps. Do as you did before except give the machine names as "csgate.wheaton.edu". For example
ssh tvandrun@csgate.wheaton.edu
Once you are on csgate, then ssh from there to one of the lab machines as before.
Windows. To logon to the lab machines, use a program called Putty, which you can download from here. From on campus, use Putty to log onto any of the cslab machines (cslab01 through cslab25). Once there, you can run the ML interpreter by just typing "sml", as you would if you were in the lab.
From off campus, first use Putty to log onto csgate.wheaton.edu. Then from csgate.wheaton.edu ssh to one of the other lab machines, for example
ssh cslab05