-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst.sml
More file actions
24 lines (17 loc) · 690 Bytes
/
first.sml
File metadata and controls
24 lines (17 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(* This is a comment. This is our first program. *)
val x = 34;
(* static environment: x : int *)
(* dynamic environment: x --> 34 *)
val y = 17;
(* static environment: x : int, y : int *)
(* dynamic environment: x --> 34, y --> 17 *)
val z = (x + y) + (y + 2);
(* static environment: x : int, y : int, z : int *)
(* dynamic environment: x --> 34, y --> 17, z --> 70 *)
val q = z + 1;
(* static environment: x : int, y : int, z : int, q : int *)
(* dynamic environment: x --> 34, y--> 17, z --> 70 *)
val abs_of_z = if z < 0 then 0 - z else z; (* bool *) (*int *)
(* static environment abs_of_z : int *)
(* dynamic environment: ..., abs_of_z --> 70 *)
val abs_of_z_simpler = abs z;