
racket192
2019-12-24 20:35:09
Dumb newbie question, but it’s baffling me. I’m using match
but it doesn’t seem to behave as I’d expect. Here’s a code snippet…

racket192
2019-12-24 20:35:18
(define ADD 1)
(define MULTIPLY 2)
(define (test x)
(match x
[ADD "add"]
[MULTIPLY "multiply"]))

racket192
2019-12-24 20:36:42
When I run (test 2)
it prints “add”. Why doesn’t it print “multiply”??

soegaard2
2019-12-24 20:38:41
As a match pattern the identifier ADD matches anything.

soegaard2
2019-12-24 20:40:18

racket192
2019-12-24 20:40:33
Thanks @soegaard2 !