COMP 212: Functional Programming

Office Hours

Dan (Exley 633): Monday, 2:30pm-3:30pm, and by appointment.
Lizzie and Max: Sunday, Exley 141, 7pm-8:30pm
Joomy and Joseph: Monday, Exley 72, 7pm-8:30pm
Kevin and Hailey: Thursday, Exley 141, 7pm-8:30pm

Labs

Lab 1 (Max, Lizzie, Kevin): Tuesday, 6pm-7:30pm, Exley 74
Lab 2 (Hailey, Joseph, Joomy): Tuesday, 7:30-9pm, Exley 72 and 74

Piazza

We will use Piazza for questions about the assignments, for students to discuss course materials, and to make announcements about the class. You are responsible for being current with the information and discussions that are posted there.

You will get an email from Piazza with a link inviting you to create an account within the first week of the term. If you haven't gotten one in that time, please contact course staff.

In addition to the web interface, there are Piazza apps for Android and iOS available for free through their respective app stores.

Handouts

Common recurrences

SML

SML of New Jersey (sml/nj) is installed in the Wesleyan Mac labs (e.g. the one on Exley 1st floor). It can be run by starting Terminal and typing sml. They are running version 110.76. You can use a variant of Emacs called Aquamacs to edit SML files (instructions for how to set up syntax highlighting for Aquamacs coming soon).

To install a local copy of sml/nj:

Mac OS

  1. Use this installer.
  2. In the terminal, run
    $ sudo port install rlwrap
            
    (This assumes you have MacPorts installed from last semester. Otherwise install from here. You will need to type your mac password.) rlwrap is a utility that lets you use the left/right arrow keys to move around and use the up/down arrows to go through lines you have previously typed.
  3. In the terminal, run
    $ echo 'export PATH="/opt/local/bin:/usr/local/smlnj/bin:${PATH}"' >> ~/.bash_profile
            
  4. In the terminal, run
    $ echo 'alias smlnj="rlwrap sml"' >> ~/.bash_profile
            
  5. Start a new terminal and you should be able to run smlnj to start SML.

Windows

  1. Use this installer. When it asks where to install, choose C:\SMLNJ\ (the default is in Program Files, but the space in that name can confuse cygwin, so change it).
  2. OPTIONAL: rlwrap is a utility that lets you use the left/right arrow keys to move around and use the up/down arrows to go through lines you have previously typed. To install it, rerun the Cygwin installer. You may still have setup-x86.exe on your computer from last semester, or you can download it again here. When you get to the screen where you select which packages to install

    cygwin

    type rlwrap into the search box, and then click on "Skip" until it becomes a number, so that the rlwrap package will be installed. Then proceed with the installer, which should install this one new package and update any other necessary packages (this should be faster than the original install.)

  3. In the cygwin terminal, run
    echo 'export PATH=$PATH:/cygdrive/c/SMLNJ/bin'>> ~/.bash_profile
            
  4. If you installed rlwrap above, then in the terminal, run
    echo 'alias smlnj="rlwrap sml.bat"' >> ~/.bash_profile
            
    Otherwise run
    echo 'alias smlnj="sml.bat"' >> ~/.bash_profile
            
  5. Start a new cygwin terminal and you should be able to run smlnj to start SML.

Text Editor

We recommend GNU emacs or Sublime Text for editing SML source files.

Sublime Text

Sublime Text is available here; get version 2. If you don't already have it, install Sublime and Package Control by following the directions on last semester's web page.

To get syntax highlighting, install the "SML (Standard ML)" package.

  1. Press on Tools > Command Palette in the menu bar and search for “install package”, then press enter.
  2. Search for “SML (Standard ML)” and press enter to install.

To use SML highlighting, you may now navigate to View > Syntax > SML.

Emacs

If you have Linux, you almost certainly have emacs installed. For Mac and Windows get:

To install SML syntax highlighting:

  1. Download sml-mode.tgz and unzip it in your software directory from last semester (~/software/ on Mac or in cygwin). This will create a directory ~/software/sml-mode-3.3-custom.
  2. Open Emacs, type Control-x Control-f to open a file, and then edit the line at the bottom of the screen to
            Find file: ~/.emacs
    and press enter. This is your emacs startup file.
  3. Copy the the contents of dotemacs-win.txt (Windows) or dotemacs-mac.txt (Mac) into this file. On Windows, you will need to edit the first line, replacing YOURNAME with your Cygwin user name. NOTE: The windows file is untested; let me know if you have problems.
  4. Save, close, and restart emacs.
  5. When you open emacs again and open a file.sml, it will now color the syntax. Also, you can run SML inside emacs as follows:
    • Control-c Control-b: load the current emacs buffer into the SML repl.
    • Control-c Control-s: pop up a separate window with the SML repl.

Some emacs resources:

LaTeX

For the written assignments, you may wish to use LaTeX.

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:

Valid CSS! Valid XHTML 1.0 Strict