What's New

12/23/08

The grades for the final exam and the cumulative grades for the course have been posted. Have a nice break!

12/15/08

A sample solution for Homework 7 has been posted on ICON.

12/11/08

Team evaluations for Hw4--Hw7 are now available on ICON's Survey section. They are due on Monday, Dec 15.
Their completion is mandatory (unless you have been authorized to work alone). You will receive an incomplete for the homework otherwise.

12/11/08 A sample solution for Homework 6 has been posted on ICON.
12/11/08 Sorry but you also need the following two files to update the parser for Hw7: file 3 and file 4. Again, dowload them into your hw7 directory.
12/10/08 Some simple test CLiter programs for Hw7 are here. Save the zip file in your hw7 directory an expand them there. To test them you need to run your code in Camelia (using Emacs or the ocaml interpreter directly may not work). Do a "Save and Run" on your completed hw7.ml first and then enter
eval "tests/p0.c";;
to run the first test (similarly for the others). To test your own CLiter programs you are advised to do the same.
12/10/08 The CLiter parser provided with Hw7 does not handle properly new line characters contained in a string value. Here is a revised version that fixes the problem: file 1 and file 2. Dowload the files into your hw7 directory.
12/06/08 If you experience problems accessing Homework 7 from ICON you can download it from here and here.
12/05/08 Homework 7 is out. It is a pair programming assignment due by 11:30pm on Friday, Dec 12.
11/20/08 Here are some example programs to test Problem 2 of Homework 6.
11/16/08 A sample solution for Homework 5 has been posted on ICON.
11/15/08

The TA's office hours for Tuesday, Nov 18 are moved to Friday, Nov 21, at 10-11:30.

11/14/08 Homework 6 is out. It is a pair programming assignment due by 11:30pm on Friday, Nov 21.
11/10/08 A note on Problem 1 in Hw5.
Some of you have asked how to build the characteristic function of a (finite) set in OCaml. For a fixed set, that is quite easy. For instance, the characteristic function of the set {1,2} can be implemented as the following (anonymous) OCaml function:

(fun y -> if y = 1 then true else if y = 2 then true else false)

or, more succintly, as the equivalent function:

(fun y -> y = 1 || y = 2)

Note though that, except for the empty set, the functions in the Set module do not return the characteristic function of a fixed set, but rather of a set determined by their input arguments (singleton takes a value x and returns the characteristic function of the set {x}, union takes the characteristic functions of a set s1 and of a set s2 and returns the characteristic function of the set union of s1 and s2, and so on).
11/08/08 The grades for Midterm II have been posted.
11/07/08 If you did not pick up your graded midterm and Hw4 today in class, you can get them from our TA (similarly for previous graded material).
11/05/08 Homework 5 is out. It is a pair programming assignment due by 11:30pm on Wednesday, Nov 12.
11/02/08 A sample solution for Homework 4 has been posted.
10/30/08

Team evaluations for Hw2 and Hw3 are now available on ICON's Survey section. They are due on Mon, Nov 3.
Their completion is mandatory. You will receive an incomplete for the homework otherwise.

10/29/08

The TA's office hours for Tuesday, Nov 4 are moved to Friday, Nov 7, at 10-11:30.

10/28/08

The following zip file contains a few examples of CLiter programs that you can use to test your solution of Hw4.

BTW, some of you have correctly discovered that the iter function from the OCaml's List module is helpful in check_stat (although not indispensable).

10/26/08 More on Hw4.
  • Some of you have reported problems in running the shell script make.sh. If you get the error

    ./make.sh: Permission denied.
    it is because make.sh was not unzipped as an executable file. To make it executable run the command
    chmod u+x make.sh
    in the same directory where make.sh is. That should fix the problem.

  • Some of you have reported problems with the functionality provided by the "Save and Typechek" button of Camelia. Pushing that button with the file hw4.ml produces a linking error. The reason is that that button calls OCaml's batch compiler (ocamlc) on hw4.ml alone. There is no direct way to tell Camelia that it should ask ocamlc to also compile and link the lexer, parser and types files.

    The only thing to do there is to use Ocaml's interactive compiler (ocaml)--either the one running in Camelia bottom windom or one called directly from a unix terminal.

    You first manually load the files types.cmo,lexer_imp.cmo, parser_imp.cmo with the #load directive, and then copy and paste the content of your hw4.ml. The same effect can also be achieved by first uncommenting the #load directives at the beginning of hw4.ml and then pushing Camelia's "Save and Run" button (which uses ocaml, not ocamlc).

10/24/08 More info about the Midterm II has been added to the Exams section.
10/24/08 Working on Hw4, some of you are having trouble loading the the files types.cmo,lexer_imp.cmo, parser_imp.cmo into the OCaml interactive compiler under Camelia in the lab. Doing the following should fix the problem.

Let's say that you have expanded hw4.zip into /space/mylogin/blah/hw4/. From a Unix shell go into that directory and type:
./make.sh
This will produce a fresh version of types.cmo,lexer_imp.cmo, parser_imp.cmo that is compatible with Camelia. Then, in Camelia's bottom input line enter the directive:
#cd "/space/mylogin/blah/hw4";;
to make sure the compiler is looking that hw4 directory. Now you should be able to load types.cmo by entering the directive:
#load "types.cmo";;
in Camelia's input line. Similarly for the other two files.
10/23/08 The grades for Homework 3 have been posted.
10/23/08 A sample solution for Homework 3 has been posted.
10/22/08 Homework 4 is out. It is a pair programming assignment due by 11:30pm on Wednesday, Oct 29.
10/13/08 Some more clarifications on Homework 3:
  • You cannot use the List.append function, or its infix version @, in Problem 1.2 (defining r_rotate) because you would then be using an auxiliary function. Needless to say, you cannot use it in Problem 3.4 (defining append) either.
  • invalid_arg is a function that takes a string, meant to contain an error message, and raises an exception containing that message.
10/11/08 Problem 3.1 in Homework 3 has a typo:
vsum : float * float list -> float * float should instead be
vsum : (float * float) list -> float * float.
In other words, the input of vsum is a list of float pairs, not a pair consisting of a float and a float list.
10/11/08 In solving Section 3 of Homework 3 it is helpful to recall or observe that the combinators in the appendix behave as follows with a non-empty list [x_1; ...; x_n]:
  • (fold_left f a [x_1; ...; x_n])   is equivalent to   (f (... (f (f a x_1) x_2) ...) x_n)
  • (fold_right f [x_1; ...; x_n] a)   is equivalent to   (f x_1 (f x_2 (... (f x_n a) ...)))
  • (map f [x_1; ...; x_n])   is equivalent to   [(f x_1); ...; (f x_n)]
  • (all p [x_1; ...; x_n])   is equivalent to   (p x_1) && ... && (p x_n)
  • (some p [x_1; ...; x_n])   is equivalent to   (p x_1) || ... || (p x_n)
They behave as follows with an empty list:
  • (fold_left f a [])   is equivalent to   a
  • (fold_right f [] a)   is equivalent to   a
  • (map f [])   is equivalent to   []
  • (all p [])   is equivalent to   true
  • (some p [])   is equivalent to   false
10/10/08 The grades for Midterm I have been posted on ICON.
10/07/08 Homework 3 is out. It is due by 7pm on Wednesday, Oct 15.
This is a pair programming assignment. See the Pair Programming sections for more info on pair programming and to find out your programming partner. Please contact your partner as soon as possible to arrange your first meeting.
10/07/08 The grades for Homework 2 have been posted on ICON.
09/30/08 The Types II class notes have been updated.
09/30/08 A sample solution for Homework 2 has been posted in ICON's drop box.
09/26/08 More info about the Midterm I has been added to the Exams section. Please refer to the Schedule section for a complete and revised reading list for the exam.
09/23/08 A couple of clarifications on Homework 2.
  • In Part 3, you are not allowed to use any of the functions from OCaml's List module, as doing that would trivialize some of the problems.
  • Problem 3.2 has a typo: "abcd" should be "abc".
09/22/08 A sample solution for Homework 1 has been posted in ICON's drop box.
09/22/08 The grades for Homework 1 have been posted on ICON.
09/17/08 Homework 2 is out. It is due by 7pm on Friday, Sep 26.
09/16/08 Our TA will not have office hours on Tue, Sep 23. Instead, he will be available on Fri, Sep 26 at 11:30am-1pm.
09/06/08 If you want to play with BNF grammars, check out this neat site, pointed out by one of you. (Thanks, Travis.) It lets you define a grammar in BNF-style syntax and then checks for you if a given string is in the grammar's language.
09/06/08 A clarification on Homework 1: in Problem 1, use Statement as the start symbol of your parse trees.
09/03/08 Homework 1 is out. It is due by 7pm on Friday, Sep 12. Check the Homeworks section for more details on dowloading the homework and submitting your solution.
09/03/08 The syllabus has been updated with the TA's office hours.
08/27/08 The class schedule contains the readings for the day and a link to class notes. It will be updated after each class throughout the semester.
08/22/08 Welcome to the 22c:111 web site!
Please check this section on a regular basis for announcements, or for updates to the other sections of the site.




Course Info

  Announcements

  Syllabus

  Schedule

Course Work

  Homeworks

  Exams

Pair Programming

  Tutorial

  Rules

  Worksheet

  Teams

Resources

  Additional Readings

  OCaml

  Icon