case and quotation in scheme & racket
<p>I was a bit surprised by this racket code printing <code>nay</code> when I expected <code>yeah</code>:</p>

<pre><code>(define five 5)
(case 5
  [(five) "yeah"]
  [else "nay"])
</code></pre>

<p>Looking <a href="https://docs.racket-lang.org/reference/case.html" rel="nofollow">at the racket documentation for case</a> makes it clearer:</p>

<blockquote>
  <p>The selected clause is the first one with a datum whose quoted form is equal? to the result of val-expr.</p>
</blockquote>

<p>So it's about quotation. I'm pretty sure that I did not yet fully grasp what quotation in lisps can buy me. I understand it in the viewpoint of macros and AST transformation. However I'm confused why is it helpful in the case of <code>case</code> for instance..?</p>

<p>I'm also curious, with this specification of <code>case</code>, can I use it to achieve what I wanted to (compare the actual values, not the quoted value), or should I use another construct for that? (<code>cond</code>, while strictly more powerful, is more verbose for simple cases, since you must repeat the predicate at each condition).</p>