+`==` operator instead of the `=` operator. Later when we discuss mutation,

+we'll discuss the difference between these two equality operations.

+Scheme has a similar pair, which they name `eq?` and `equal?`. In Python,

+these are `is` and `==` respectively. It's unfortunate that OCaml uses `==` for the opposite operation that Python and many other languages use it for. In any case, OCaml will accept `(f) == f` even though it doesn't accept

+`(f) = f`. However, don't expect it to figure out in general when two functions

+are equivalent. (That question is not Turing computable.)

+

+ # (f) == (fun x -> x + 3);;

+ - : bool = false

+

+Here OCaml says (correctly) that the two functions don't stand in the `==` relation, which basically means they're not represented in the same chunk of memory. However as the programmer can see, the functions are extensionally equivalent. The meaning of `==` is rather weird.]

+

+

Booleans in OCaml, and simple pattern matching

----------------------------------------------

Where we would write `true 1 2` in our pure lambda calculus and expect

it to evaluate to `1`, in OCaml boolean types are not functions

-(equivalently, are functions that take zero arguments). Selection is

+(equivalently, they're functions that take zero arguments). Instead, selection is

+Expressions that don't terminate all belong to the **bottom type**. This is a subtype of every other type. That is, anything of bottom type belongs to every other type as well. More advanced type systems have more examples of subtyping: for example, they might make `int` a subtype of `real`. But the core type system of OCaml doesn't have any general subtyping relations. (Neither does System F.) Just this one: that expressions of the bottom type also belong to every other type. It's as if every type definition in OCaml, even the built in ones, had an implicit extra clause:

+

+ type 'a option = None | Some of 'a;;

+ type 'a option = None | Some of 'a | bottom;;

+

+Here are some exercises that may help better understand this. Figure out what is the type of each of the following: