Analogously with Pascal, we will use the keyword VAR . You can think of foo as a pointer to an area in memory containing the value 23. As we saw, a box is rather like a cons box with only one field. At the cost of a little clumsiness of notation, we have now a programming language that has imperative features. When we pass a box to a procedure, we give that procedure the ability to modify the contents of our own variable.
Procedures can now execute imperative side effects.
Here is some syntax, similar to let , that allows us do that here in a by-reference way. The above procedure sumto is pretty harmless in that it does not cause side-effects in its caller's data area. Then write a paragraph explaining if there is any difference between what swap does and what swap2 does. The write a paragraph explaining which of swap, swap2 you would prefer to use and why.