(* CSCI 3155: Meeting 19: References (SML) *) let (* Allocate a memory cell with contents initialized to 0. *) val p: int ref = ref 0 (* Create an alias to the allocated cell. *) val r: int ref = p in (* Change the cell. *) r := 1; (* Show the contents. *) TextIO.print ("!r is " ^ Int.toString (!r) ^ "\n" ^ "3 + (!r) is " ^ Int.toString (3 + !r) ^ "\n" ^ "!p is " ^ Int.toString (!p) ^ "\n\n") end