[racket] Compile-time evaluation
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