+ which beta-reduces to:
+
+ ((lambda (x) B) A)
+
+ and that means the same as:
+
+ (let* [(x A)] B)
+
+ in other words: evaluate `B` with `x` assigned to the value `A`.
+
+ Similarly, this in OCaml:
+
+ let bar = fun x -> B in
+ bar A
+
+ is equivalent to:
+
+ (fun x -> B) A
+
+ and that means the same as:
+
+ let x = A in
+ B
+
+8. Pushing a "let"-binding from now until the end
+
+ What if you want to do something like this, in Scheme?
+
+ (let* [(x A)] ... for the rest of the file or interactive session ...)
+
+ or this, in OCaml:
+
+ let x = A in
+ ... for the rest of the file or interactive session ...
+
+ Scheme and OCaml have syntactic shorthands for doing this. In Scheme it's written like this:
+
+ (define x A)
+ ... rest of the file or interactive session ...
+
+ In OCaml it's written like this:
+
+ let x = A;;
+ ... rest of the file or interactive session ...
+
+ It's easy to be lulled into thinking this is a kind of imperative construction. *But it's not!* It's really just a shorthand for the compound `let`-expressions we've already been looking at, taking the maximum syntactically permissible scope. (Compare the "dot" convention in the lambda calculus, discussed above. I'm fudging a bit here, since in Scheme `(define ...)` is really shorthand for a `letrec` epression, which we'll come to in later classes.)
+
+9. Some shorthand
+
+ OCaml permits you to abbreviate:
+
+ let bar = fun x -> B in
+ M
+
+ as:
+
+ let bar x = B in
+ M
+
+ It also permits you to abbreviate:
+
+ let bar = fun x -> B;;
+
+ as:
+
+ let bar x = B;;
+
+ Similarly, Scheme permits you to abbreviate:
+
+ (define bar (lambda (x) B))
+
+ as:
+
+ (define (bar x) B)
+
+ and this is the form you'll most often see Scheme definitions written in.
+
+ However, conceptually you should think backwards through the abbreviations and equivalences we've just presented.
+
+ (define (bar x) B)
+
+ just means:
+
+ (define bar (lambda (x) B))
+
+ which just means:
+
+ (let* [(bar (lambda (x) B))] ... rest of the file or interactive session ...)
+
+ which just means:
+
+ (lambda (bar) ... rest of the file or interactive session ...) (lambda (x) B)
+
+ or in other words, interpret the rest of the file or interactive session with `bar` assigned the function `(lambda (x) B)`.
+
+
+10. Shadowing
+
+ You can override a binding with a more inner binding to the same variable. For instance the following expression in OCaml:
+
+ let x = 3 in
+ let x = 2 in
+ x
+
+ will evaluate to 2, not to 3. It's easy to be lulled into thinking this is the same as what happens when we say in C:
+
+ int x = 3;
+ x = 2;
+
+ <em>but it's not the same!</em> In the latter case we have mutation, in the former case we don't. You will learn to recognize the difference as we proceed.
+
+ The OCaml expression just means:
+
+ (fun x -> ((fun x -> x) 2) 3)
+
+ and there's no more mutation going on there than there is in:
+
+ <pre><code>∀x. (F x or ∀x (not (F x)))
+ </code></pre>
+
+ When a previously-bound variable is rebound in the way we see here, that's called **shadowing**: the outer binding is shadowed during the scope of the inner binding.
+
+ See also:
+
+ * [[!wikipedia Variable shadowing]]
+
+
+Some more comparisons between Scheme and OCaml
+----------------------------------------------
+
+* Simple predefined values
+
+ Numbers in Scheme: `2`, `3`
+ In OCaml: `2`, `3`
+
+ Booleans in Scheme: `#t`, `#f`
+ In OCaml: `true`, `false`
+
+ The eighth letter in the Latin alphabet, in Scheme: `#\h`
+ In OCaml: `'h'`
+
+* Compound values
+
+ These are values which are built up out of (zero or more) simple values.
+
+ Ordered pairs in Scheme: `'(2 . 3)` or `(cons 2 3)`
+ In OCaml: `(2, 3)`
+
+ Lists in Scheme: `'(2 3)` or `(list 2 3)`
+ In OCaml: `[2; 3]`
+ We'll be explaining the difference between pairs and lists next week.
+
+ The empty list, in Scheme: `'()` or `(list)`
+ In OCaml: `[]`
+
+ The string consisting just of the eighth letter of the Latin alphabet, in Scheme: `"h"`
+ In OCaml: `"h"`
+
+ A longer string, in Scheme: `"horse"`
+ In OCaml: `"horse"`
+
+ A shorter string, in Scheme: `""`
+ In OCaml: `""`
+
+
+
+What "sequencing" is and isn't
+------------------------------
+
+We mentioned before the idea that computation is a sequencing of some changes. I said we'd be discussing (fragments of, and in some cases, entire) languages that have no native notion of change.
+
+Neither do they have any useful notion of sequencing. But what this would be takes some care to identify.
+
+First off, the mere concatenation of expressions isn't what we mean by sequencing. Concatenation of expressions is how you build syntactically complex expressions out of simpler ones. The complex expressions often express a computation where a function is applied to one (or more) arguments,
+
+Second, the kind of rebinding we called "shadowing" doesn't involve any changes or sequencing. All the precedence facts about that kind of rebinding are just consequences of the compound syntactic structures in which it occurs.
+
+Third, the kinds of bindings we see in:
+
+ (define foo A)
+ (foo 2)
+
+Or even:
+
+ (define foo A)
+ (define foo B)
+ (foo 2)
+
+don't involve any changes or sequencing in the sense we're trying to identify. As we said, these programs are just syntactic variants of (single) compound syntactic structures involving `let`s and `lambda`s.
+
+Since Scheme and OCaml also do permit imperatival constructions, they do have syntax for genuine sequencing. In Scheme it looks like this:
+
+ (begin A B C)
+
+In OCaml it looks like this:
+
+ begin A; B; C end
+
+Or this:
+
+ (A; B; C)
+
+In the presence of imperatival elements, sequencing order is very relevant. For example, these will behave differently:
+
+ (begin (print "under") (print "water"))
+
+ (begin (print "water") (print "under"))
+
+And so too these: