COS 510 - Old announcements


CML example: An example of implementing a concurrent-read-exclusive-write lock in CML is now available.

Visitor Patterns: A useful example can be found in Why Visitors? by Jens Palsberg.

Corrections and clarifications to problem set 9: The depth function in my ML program always returned 1. The correct version is,

fun depth (NUM _) = 1 | depth (PLUS(a,b)) = 1 + Int.max(depth a, depth b)

Corrections and clarifications to problem set 8:

Problem 2 said, "Use public new constructors for doll creation," but problem 3 said,

int f(Doll d) {
  int w = d.weight();
  int x = d.shell().weight();
  return x-w;
}

I have corrected problem 3 to say this instead:

int f(Doll d) {
  int w = d.weight();
  int x = (new shell(d)).weight();
  return x-w;
}
Corrections and clarifications to problem set 7:

1. Problem set 7 is due November 17th. One web page had the right date, and another page had the wrong date.

2. A baby doll weighs 10 grams. A doll shell(baby) weighs 30 grams: 20 for the shell, 10 for the baby. The doll shell(shell(baby)) weighs 60 grams: 30 for the outer shell, 20 for the inner shell, 10 for the baby.

If I create

  a = baby
  b = shell(a)
  c = baby
  d = shell(c)
  e = shell(d)
Then I can create a box with the list [b,e]. It is illegal to attempt a box[b,c,d,e] that uses d more than once. However, your implementation for this problem does not have to detect illegal operations of this kind.

Midterm exam corrections and clarifications.

Type reconstruction example. I have written an example of type reconstruction that helps explain Harper chapter 11. I will go over this in class on Friday October 20th. A similar problem will be on the midterm exam.

Correction to problem set 5. The program in part 1j was missing the word "fi". October 18, 8:40 a.m.

Correction to problem set 5. You will need to add the following lines to minml.sml:

     | TIMES of typ * typ

     | Pair of exp * exp
     | Fst  of exp
     | Snd  of exp
Also, the parser accepts pair-expressions of the form (e1,e2), not <e1,e2>.
October 17, 10:40 a.m.

Yet another correction in problem set 2. The type of fv should be Exp -> string list and the type of subst should be (Exp * string) -> Exp -> Exp. (September 28, 10:20 a.m.)

Viewing large expressions
Q: A student asks,

> When i run the program, it gave stuffs like 
> val subst_result = Fun ("f","axy",INT,INT,Primop (Plus,[#,#])) : exp
> I don't like the #'s. How can i get the real value, not the #?
A: Execute the following commands:
Compiler.Control.Print.printDepth := 100;
Compiler.Control.Print.printLength := 100;
printDepth controls how deep in nesting the pretty-printer will go before abbreviating with a #.
printLength controls how many elements of a list the pretty-printer will show. (September 28, 10 a.m.)

Clarification in problem set 2. Harper's Exercise 14 is not very clear, and I have provided an explanation in the problem assignment. (September 27, 2:45 p.m.)

Another correction to problem set 2. The version posted at 10:25 left the Var of string constructor from the datatype; it's corrected now. (September 27, 1:40 p.m.)

Correction to problem set 2. Originally, problem 2 said, "The relevant datatypes are on page 13 of Harper." This is not true; the datatypes on page 13 are not for MinML. The relevant datatypes are now given on the problem set 2 web page. (September 27, 10:25 a.m.)

Problem set 1 is due September 22, not September 29 as originally stated on the problem set.

I expect to install Standard ML of New Jersey version 110.0.7 sometime in October. This version fixes certain bugs in Concurrent ML, and will be useful for that section of COS 510. If you continue to use /usr/local/sml/bin/sml on any of the department cycle servers (shades or penguins), you need not do anything.

Back to COS 510 front page