Guide to ML assignments

This guide is to help you get used to using the ML interpreter for your homework assignments.

1. 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---since both of those are in New Jersey, that's how the software got its name.

2. 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. Then, for each problem, go to the turn-in site and submit.

3. Getting the ML interpreter

You will need to be able to use the ML interpreter from your computer. Here are your options:

A. Installing the ML interpreter locally on your computer

In the past, this is what most students have done. 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.84/index.html for the downloads page.

However, it turns out that the installer for latest version of SML/NJ does not play nicely with recent versions of Mac OS. I was able to get it to work on my laptop (MacBook Pro running Catalina) using a tool called Homebrew. Here is my summary of the steps:

First, install a tool called Homebrew by pasting the following line into your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
That will take about five minutes to download and install, and you'll need to enter your password for your computer and things like that. When it is done, paste the following line intor your terminal:
brew install --cask smlnj
That also will take a few minutes, ask for your password, etc. Once that is done, verify that sml was installed by typing
/usr/local/smlnj/bin/sml
That should launch the SML interpreter. Use ctrl-D to quit. If you have done all this and want to be able to get the interpreter by just typing sml instead of /usr/local/smlnj/bin/sml, then ask for help.

B. Using the ML interpreter through ThunderApps

ThunderApps is a cloud-based tool that gives you access to a variety of software packages that the college has licences for. Once you are set up to use the tool, you can find SML/NJ in the list of avaialble apps. See this Wheaton-Answers article for more information about ThunderApps in general.

C. Using the ML interpreter remotely through the computer science lab

If you are used to using the computer science lab, then you may find it convenient to use the SML interpreter by logging into the lab through ssh (or PuTTy from a Windows machine). Running sml will start the interpreter.

D. Using an online SML interpreter

I am aware of two online SML interpreters:

https://sosml.org/editor

https://www.tutorialspoint.com/execute_smlnj_online.php

I have not used these, so I can't give them a recommendation either way. But they are an option if you want to look into those.


Thomas VanDrunen
Last modified: Thu Jan 20 13:04:49 CST 2022