diff --git a/lecture/lec01/lec01-live.ml b/lecture/lec01/lec01-live.ml new file mode 100644 index 0000000000000000000000000000000000000000..daafe903a94183f9dd77eb62037e893c13e85862 --- /dev/null +++ b/lecture/lec01/lec01-live.ml @@ -0,0 +1,62 @@ +(* this is a comment + (* they can even nest *) +*) + +#utop_prompt_dummy +let _ = UTop.set_show_box false + +(* static environment: empty-ish + dynamic enivornment: empty-ish +*) + +(* let variable-name = expression *) + +let x = 34 + +(* + static environment: x : int + dynamic enviornment: x = 34 +*) + +let y = 17 + +(* + static environment: x : int, y : int + dynamic enviornment: x = 34, y = 17 +*) + +(* + + + / \ + + + + / \ / \ + x y y 2 + +*) + + + +let z = (x + y) + (y + 2) + +(* + static environment: x : int, y : int, z : int + dynamic enviornment: x = 34, y = 17, z = 70 +*) + +let q = z + 1 + +let abs_of_z = + if z < 0 then + -z + else + z + + + + + + + + + +