From 3ce7cd6b143bb54387ec6b16a4a4aa5774a9baf1 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Sun, 21 Nov 2010 20:30:51 -0500 Subject: [PATCH] week9 tweak Signed-off-by: Jim Pryor --- week9.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/week9.mdwn b/week9.mdwn index 19041582..c01890e4 100644 --- a/week9.mdwn +++ b/week9.mdwn @@ -613,7 +613,7 @@ Programming languages tend to provide a bunch of mutation-related capabilities a So we have here the basis for introducing a new kind of equality predicate into our language, which tests not for qualitative indiscernibility but for numerical equality. In OCaml this relation is expressed by the double equals `==`. In Scheme it's spelled `eq?` Computer scientists sometimes call this relation "physical equality". Using this equality predicate, our comparison of `ycell` and `xcell` will be `false`, even if they then happen to contain the same `int`. - Isn't this interesting? Intuitively, elsewhere in math, you might think that qualitative indicernibility always suffices for numerical identity. Well, perhaps this needs discussion. In some sense the imaginary numbers ι and -ι are qualitatively identical, but numerically distinct. However, arguably they're not *fully* qualitatively identical. They don't both bear all the same relations to ι for instance. But then, if we include numerical identity as a relation, then `ycell` and `xcell` don't both bear all the same relations to `ycell`, either. Yet there is still a useful sense in which they can be understood to be qualitatively equal---at least, at a given stage in a computation. + Isn't this interesting? Intuitively, elsewhere in math, you might think that qualitative indicernibility always suffices for numerical identity. Well, perhaps this needs discussion. In some sense the imaginary numbers ι and -ι are qualitatively indiscernible, but numerically distinct. However, arguably they're not *fully* qualitatively indiscernible. They don't both bear all the same relations to ι for instance. But then, if we include numerical identity as a relation, then `ycell` and `xcell` don't both bear all the same relations to `ycell`, either. Yet there is still a useful sense in which they can be understood to be qualitatively equal---at least, at a given stage in a computation. Terminological note: in OCaml, `=` and `<>` express the qualitative (in)discernibility relations, also expressed in Scheme with `equal?`. In OCaml, `==` and `!=` express the numerical (non)identity relations, also expressed in Scheme with `eq?`. `=` also has other syntactic roles in OCaml, such as in the form `let x = value in ...`. In other languages, like C and Python, `=` is commonly used just for assignment (of either of the sorts we've now seen: `let x = value in ...` or `change x to value in ...`). The symbols `==` and `!=` are commonly used to express qualitative (in)discernibility in these languages. Python expresses numerical (non)identity with `is` and `is not`. What an unattractive mess. Don't get me started on Haskell (qualitative non-identity is `/=`) and Lua (physical (non)identity is `==` and `~=`). @@ -636,7 +636,7 @@ Programming languages tend to provide a bunch of mutation-related capabilities a xcell == wcell xcell == zcell - If we express qualitative identity using `=`, as OCaml does, then all of the salient comparisons would be true: + If we express qualitative indiscernibility using `=`, as OCaml does, then all of the salient comparisons would be true: ycell = wcell ycell = zcell -- 2.11.0