[racket] clarification for beginners please

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Apr 25 18:13:25 EDT 2013

On Thu, Apr 25, 2013 at 5:35 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> eqv? is Scheme's attempt at incorporating an approximation to the so-called notion of observational equivalence. Two values are observationally equivalent if they are interchangeable in all contexts -- wherever you see one value, you can replace it with another value in an expression position. (If these values could show up inside of strings it would be trivial to distinguish all values.) You can easily show that this mathematically defined function is not computable. Therefore eqv? must be an approximation. And the rationale must be that it is useful in some programs. From a microscopic perspective, eqv? is mostly like equal? but when its recursive traversal reaches compound data it falls back on pointer equality. From a program perspective, I will admit that I fail to have an example handy.

When eqv? was first defined, it made a little more sense than that --
it traversed all of Scheme's immutable "data structures": numbers and
characters, making it a lot like Henry Baker's `egal`.  In the
intervening years, Racket has added lots of other immutable data
structures, but we've kept `eqv?` the way it originally was.


Posted on the users mailing list.