In your own words, explain the difference between syntax and semantics. Also explain the difference between static semantics and dynamic semantics.
- The section on scope in the textbook discusses
let x = 5 in ((let x = 6 in x) + x)
Using the dynamic semanics of
letexpressions, explain how that expression evaluates.
- Run the following code in the toplevel.
let x = 1;; let x = 2;; x;;
Why is it valid to say that variables in OCaml are immutable, despite the output of utop? Your answer should incorporate the ideas of shadowing and nested let expressions.
Submit to CMS: Submit your written responses to the questions above. As always, keep them brief: no more than one page total.