Library Documentation

We will be supplying SML libraries that support various collection types including Sequences, Sets and Tables. We also include costs specifications for specific classes of implementation of the interfaces.

Pseudocode Syntax

In lectures and in the lecture notes we will be using pseudocode for describing algorithms. This code uses set notation. To aid your understanding, we have provided a description on how this syntax maps to our SML libraries .

SML Style Guide

We have written a style guide to help you write clean, clear, and concise SML. You should follow it closely and feel free to ask for clarifications.


This course will make heavey use of two bboards:

  • academic.cs.15-210.announce will be used for any course announcements. You should read this bboard very regularly, but you may not post to it.
  • academic.cs.15-210.discuss will be used as a way for you to ask questions. You should feel free to post any questions you may have about the course here, as long as they don't give away any answers or violate the academic integrity policy.

To subscribe to these bboards:

  1. Go to webmail
  2. Click on "folders" at the top of the page
  3. In the righthand pane of the "subscribe/unsubscribe" section, find our two bboards.
  4. Select them one at a time and click subscribe

Once you've done this and refreshed the page, the bboards should show up in the list of folders on the lefthand side of webmail. They should also show up in a modern email client that you use to access your cyrus email.

To make a fresh thread in the discuss bboard, send mail to To reply to a thread that's already been started, just use reply all instead of reply. Preserve existing thread structure as appropriate.


We have a course blog.


This course will make heavy use of SML/NJ's compilation manager. We have a brief document on how to use CM that should be sufficient for this course.


We will use a git repository to hand out your homework assignments, sample code, and our libraries. The documentation explains how to access our git repository and how to keep your personal revisions locally. It also documents how to submit your assignments on AFS and to check for submission errors.


We require that you turn in your written homework assignments as a typeset PDF. There are many ways to create such a PDF, and you may use whichever one you feel comfortable with, but LaTeX is one of the best solutions.

LaTeX is built from Don Knuth's TeX typesetting language, and has grown through community support to be both extremely powerful and easy to use. LaTeX is installed on the Andrew UNIX servers, and can be downloaded and installed on local machines as well. There are any number of excellent resources about how to use LaTeX; a few are listed here for your convenience.

LaTeX source files can be created with any text editor, so emacs and vim are excellent choices. There are several LaTeX specific IDEs that you may find more comfortable to use, depending on your working environment:

We have produced a simple file that shows off many of LaTeX's more helpful features in both source and pdf. There is a basic template that you can edit and use for your homework solutions on the 251 page linked above. If you have your own format that you prefer to use, please feel free to do so.


An official installation of SML of New Jersey (sml/nj) can be run from the Andrew Unix servers at They are running version 110.69. All of your submissions for the class should compile on the unix machines.

sml/nj can be run from the command 'sml' in your shell. Alternatively, we have set up a macro 'smlnj' in /afs/andrew/course/15/210/bin that automatically wraps this with rlwrap, a convenient utility that allows you to use the arrow keys to go back and forth on a line and traverse your command history.

If you want a local copy of sml/nj, one can be acquired from the sml/nj website. There is source code available there, as well as platform-specific installation instructions. If you are running a distribution of Linux, there is a decent chance that you can find sml/nj in your package manager, though the version may or may not be the same as the one on the unix machines. If you end up doing this, we encourage you to make sure your code compiles on the unix machines before submitting it.

Andrew UNIX

Your Andrew ID gives you access to the UNIX servers via SSH. To use them, SSH to with the SSH client of your choice. SSH ships with OS X, and can be accessed via the terminal; almost all distributions of Linux also ship with SSH or have it available through their package managers; putty is an excellent SSH client for windows users.

Once you have connected to one of the UNIX servers, you will be presented with a shell prompt, and you can work from there. The Computing Services documentation on how to use Andrew UNIX may be helpful.

You will need to use Andrew UNIX for electronic homework submissions. The directory for handin is located at /afs/andrew/course/15/210/handin/assignment name/your andrew id/

Text Editors

SML is best written in a text editor. There are IDE modes for large IDEs like Eclipse, but they are typically more trouble than they're worth. Emacs and Vim are the two clear choices for text editors in a modern UNIX environment. Rather than get into the question of which one is better, we'll give some guidence for how to use both here. Both are very mature and stable projects that provide largely the same functionality. Which of the two you prefer is entirely a question of taste.

GNU emacs

The guiding principle of emacs philosophy is that you should never have to leave emacs to preform a task if you don't want to. If you're writing C, it can run your makefile, and show you GDB output internally. It even has tetris and email clients built in. Despite being extremely large in this sense, emacs scales down to the smallest of text files elegantly.

The most sane version to use is GNU emacs, although both GNU emacs and Xemacs are installed on the Andrew UNIX machines. There's a ton of good documentation for how to use it available on the web, some of which is linked here.

  • Wikipedia has an article on the general history and culture of emacs, for the curious.
  • One of many bare-bones tutorials on getting started with emacs
  • The emacs wiki is the omnibus resource for emacs usage
  • To exit emacs, type Control-X, then Control-C. A prompt may appear asking you about saving any changes you made; if this happens, you will need to answer it before exiting.

You can control large swaths of emacs settings---such has indentation style, compiler hooks, and syntax highlighting---by setting its mode. There is an excellent mode specifically for editing SML (sml-mode). We wrote a short how-to to get you started with sml-mode.

Vi iMproved (vim)

The guiding principle of vim philosophy is that your text editor should do exactly that: edit text. It differs from emacs in that it makes much more extensive use of modes to get things done. You start out in command mode, which interprets keystrokes as commands, and can switch back and forth between it, insert mode (which actually enters text), and visual mode (which lets you select and modify large chunks of text). Having modes means that vim does not require a long series of keystrokes for every command.

Most Unix machines probably already have vim installed on them, but if not, odds are there is a vim package of some sort available. Windows users can also install a graphical version of vim to use as a text editor. Again, there is a great deal of documentation for vim available on the internet.

  • Wikipedia also has an article on the history of vim, as well as an explanation of modal editing.
  • There are many vim tutorials available online; here is one that you may find useful.
  • The collection of vim tips is a great grab bag of commands you'll want to use one day.
  • There is also a vim-specific wiki
  • To exit vim, press escape until you are sure you are in command mode, then type ":q" and press enter. If you have made changes and do not wish to save them, type ":q!" instead; if you have made changes that you would like to save, type ":wq" instead.