CS152
Chris Pollett
Apr. 29, 2009
As we talk about the above we'll continue to introduce ML.
datatype 'a Stack = EmptyStack | Stack of 'a*('a Stack);
structure SomeName = struct val bob =50; (* more values *) fun curry a b = (a, b); (* more functions *) end;
SomeName.bob (* or *) open SomeName; bob;
signature SomeType = sig val bob:int; val curry : int -> int -> int * int (* last thing does not end with a ; *) end;
structure SomeOtherName: SomeType = SomeName;
fun count 0 b = b | count a b = count (a - 1) (b + 1);
val i = ref 1; while !i <= 10 do (print (Int.toString(!i)); print (" "); i := !i +1);