This is a limitation, apparently, of the Racket version. Racket's (case ...) quotes its matching clauses, so they are not actually evaluated, just compared to the value expression with equal?
So this works:
(select case (mod 5 2)
((1) 'foo)
((0) 'bar))
; returns 'foo
But this doesn't:
(select case 1
((mod 5 2) 'foo)
((mod 2 2) 'bar))
; expect 'foo, but falls through instead.void
I think the case can be made for writing our own (select case ...) to allow for this usage. It's a common enough behavior in other language's case statements, so if it's possible to do with Racket's macros I think it's worth implementing.
This is a limitation, apparently, of the Racket version. Racket's (case ...) quotes its matching clauses, so they are not actually evaluated, just compared to the value expression with equal?
So this works:
But this doesn't:
I think the case can be made for writing our own (select case ...) to allow for this usage. It's a common enough behavior in other language's case statements, so if it's possible to do with Racket's macros I think it's worth implementing.