(* CSE 341, Spring 2008 *)
(* Lecture 1, our first ML program *)
(* val is a keyword
x is a variable name
= is used as a keyword here (has different meaning in expressions)
34 is a very simple expression (and value)
; is used as a keyword here (has different meaning in expressions)
*)
val x = 34;
(* environment: x-->34 *)
val y = 17;
(* environment: y-->17, x-->34 *)
(* to evaluate an addition, evaluate the subexpressions and add *)
(* to evaluate a variable, lookup its value in the environment *)
val z = (x + y) + (y + 2);
(* environment: z-->70, y-->17, x-->34 *)
val q = z+1;
val abs_of_z = if z < 0 then 0 - z else z;
val abs_of_z_simpler = abs z