CSCI 189 - Assignment 3 Lab

The Problem set for this assignment is due 5:00pm September 26, 2005.

Start Haskell using the following steps (these are the same as the ones you used in the Assignment 1 Lab).

  1. Open the file http://www.bowdoin.edu/~allen/courses/cs189/Asst3/Asst3.lhs from a Web browser.
  2. Save this file as Asst3.lhs (do not append the .txt suffix) on the Desktop.
  3. Open two windows:

    (a) A Unix "Shell" where you can run Haskell programs: select Macintosh HD -> Applications -> Utilities -> Terminal

    (b) A text editor where you can edit Haskell programs: select Macintosh HD -> Applications -> TextEdit

  4. Line up these two window side by side so that you can see them both.
  5. Now switch to the right-hand window and open the tutorial lab exercise for this assignment by selecting File -> Open -> Asst3.lhs The following text should appear in that window.

    -------------------------------------------------------
    Using Haskell to Help Think about Numbers and Sequences
    Allen Tucker
    January 2004
    -------------------------------------------------------

    > module Asst3 where

    Sometimes it is useful to generate a few sequences of numbers that have a certain property to help us understand that property better. For instance, suppose we are told that the sum of the first n odd integers is n^2. Our first instinct is to try out a few of these:

     n   sum                 n^2
    --- ------------------- ---
    1 1 1
    2 1 + 3 4
    3 1 + 3 + 5 9
  6. Now switch to the left-hand window and type the following two lines:
This will start Haskell running, and it will look something like this.

You should complete this tutorial before beginning the Problem set for this assignment.