[racket] clarification for beginners please
Probably a crab would be filled with a sense of personal outrage
if it could hear us class it without ado or apology as a crustacean,
and thus dispose of it. "I am no such thing, it would say: I am
MYSELF, MYSELF alone."
- William James, The Varieties of Religious Experience
eq? is a function for letting us distinguish different crabs that would
otherwise look the same to us.
Let's say that we have two crabs c1 and c2.
;;;;;;;
;; In BSL:
;;;;;;;
(define-struct crab (name))
(define c1 (make-crab "joe"))
(define c2 (make-crab "joe"))
;;;;;;;
As it stands, we may want to say they are the same because they "look" the
same --- they have the same structural shape. equal? tells us that they
look the same.
;;;;;;
> (equal? c1 c2)
true
;;;;;;
But as William James notes, these crabs might be outraged at our lack of
crustacean discrimination. They may argue: we may look alike, but we are
different crabs. How shall we judge?
;;;;;;
> (eq? c1 c2)
false
;;;;;;
A crab is itself, itself alone:
;;;;;;
> (eq? c1 c1)
true
;;;;;;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130425/0f123c0d/attachment-0001.html>