[racket] Compile-time evaluation

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Mon Jul 29 21:32:53 EDT 2013

On 2013-07-30 04:28:49 +0400, Roman Klochkov wrote:
>    (case 5
>        [((hash-dot (+ 2 3))) 1]
>        [else 2])
>    => 2

The issue here is that `case` does not actually evaluate the datum parts
of each clause, instead essentially just `quote`ing them and matching on
that. So effectively you are matching on the datum `(quote (hash-dot (+ 2 3)))`
in that case expression.

This is a confusing aspect of `case` that is a leftover from our Scheme
roots. You can avoid it by using `evcase` like Matthias suggested, but
you might just consider using `match` instead.

Cheers,
Asumu

Posted on the users mailing list.