<div dir="ltr"><div><div>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?<br><br></div>
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:<br>
<br>(define FOUR "four")<br>(define A (make-posn 4 5))<br>(define B (make-posn (+ 3 1) (- 6 1)))<br>"-------------"<br>(equal? FOUR "four")<br>(equal? 4 (+ 1 3))<br>(equal? 4 (posn-x (make-posn 4 3)))<br>
(equal? A B)<br>"-------------"<br>(eq? FOUR "four")<br>(eq? 4 (+ 1 3))<br>(eq? 4 (posn-x (make-posn 4 3)))<br>(eq? A B)<br>"---------------"<br>(eqv? FOUR "four")<br>(eqv? 4 (+ 1 3))<br>
(eqv? 4 (posn-x (make-posn 4 3)))<br>(eqv? A B)<br><br><br></div>Why in the world would the above-defined A and B be considered "equal?" but not "eq?" or "eqv?"?<br clear="all"><div><div><div>
<br>-- <br><div dir="ltr"><i>Joe Ford<br>
Technology Resources, Scheduling & Yearbook<br>
Holland Hall<br>
<a href="mailto:jford@hollandhall.org" target="_blank">jford@hollandhall.org</a><br><br></i><img src="" alt=""><br><br></div>
</div></div></div></div>