How to use Standard ML on `sparky' and save transcripts of SML sessions

  1. Sparky accounts

    To get an account on `sparky'check in the Library SINC site -- room S-1460.

  2. The Standard ML Interpreter

    To run the New Jersey Standard ML interpreter on `sparky' use the command sml or /usr/local/bin/sml.

    The - prompt indicates SML is ready for your input. Input may be typed on one or more lines and needs to be terminated by a semicolon `;'. The = prompt is used for the continuation of input expressions that require more than one line.

    To end a Standard ML session simply type Ctrl d, i.e., press the control key and the d key simultaneously. If you wish to cancel your current input, type Ctrl c.

  3. Loading files

    You can load files into the SML interpreter via the `use' command. For instance, save your function definitions in a file `defs' and then load them by entering:

    - use "defs";

    The double quotes around the file name defs are required. When creating files for your various function definitions and corresponding test cases, do not include any SML prompt, - or =.

  4. Editors

    The easiest way to use SML on sparky is to telnet to sparky from a PC or a Mac. Inside the telnet window, start up SML. Next to the telnet window, open an editor window. It should be a text editor like Notepad on Windows or SimpleText or BBEdit on Macs (but not a full-fledged word processor like Microsoft Word). Now type in the SML functions into the editing window. Once you think they are okay, copy and paste one or more functions into the telnet window and see if they work. But only edit in your Notepad/Simpletext. When you have your functions working, you can save them in the editor window.

    If you want to work entirely on sparky, then to create and edit SML function definitions and test cases you will need to use a text editor. The simplest is `pico'. If you need help with using an editor, ask a Computer Science Help Desk Assistant. A schedule of Help Desk hours is posted throughout the Computer Science Department.

  5. Saving an SML Session Transcript

    If you are telnet'ing into sparky, the easiest way to make a transcript is to just copy and paste from the telnet window into a new file in your text editor. Also, if you are using a terminal emulator, you may be able to "record" your session (depending on which program you're using). If you working directly with sparky, one way to capture your interactions with the SML interpreter into a file is to use the UNIX `script' command. On a UNIX prompt, enter the command `script' (without quotes) followed by return. Now all entries/replies will be captured into a file named `typescript'. To terminate script mode, enter `exit'

    CAUTION:

    1. Don't try to edit while using script. Don't use script while running script.
    2. Each time you run script the file `transcript' will be written over. If you wish to save its contents you should rename the file using the `mv' command. For example, `mv transcript hw-script' moves (renames) transcript to a new file named hw-script.