[racket] clarification for beginners please

From: Ford, Joe (jford at hollandhall.org)
Date: Thu Apr 25 14:31:57 EDT 2013

I have a group of high school students with a question... can someone
please explain to beginner Racket users the differences between these three
boolean functions:   eq?   equal?   eqv?

We have read the help menu verbage visible from DrRacket, but simply don't
understand what it is saying.  Maybe that's lack of context or
vocabulary... but we're struggling a bit.  To test simple variations of
application, we wrote some simple code (shown below) but don't understand
why the results are what they are:

(define FOUR "four")
(define A (make-posn 4 5))
(define B (make-posn (+ 3 1) (- 6 1)))
"-------------"
(equal?  FOUR  "four")
(equal?  4  (+ 1 3))
(equal?  4 (posn-x (make-posn 4 3)))
(equal? A B)
"-------------"
(eq?  FOUR  "four")
(eq?  4  (+ 1 3))
(eq?  4 (posn-x (make-posn 4 3)))
(eq? A B)
"---------------"
(eqv?  FOUR  "four")
(eqv?  4  (+ 1 3))
(eqv?  4 (posn-x (make-posn 4 3)))
(eqv? A B)


Why in the world would the above-defined A and B be considered "equal?" but
not "eq?" or "eqv?"?

-- 
*Joe Ford
Technology Resources, Scheduling & Yearbook
Holland Hall
jford at hollandhall.org

*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130425/02f84797/attachment.html>

Posted on the users mailing list.