Minor code correction in the Quick Start docs
thelonious opened this issue · 2 comments
thelonious commented
I tried using the following code from the Quick Start section in the docs:
(define (tokenize s)
(for/list ([str (regexp-match* #px"\\(\|\\)\|\\w+" s)])
(match str
["("
(token 'LEFT-PAREN str)]
[")"
(token 'RIGHT-PAREN str)]
[else
(token 'WORD str)])))
Racket complained about the use of else
in the last clause. I was able to change that to _
and then it worked fine.
mbutterick commented
Strange. What version of Racket? else
is a little misleading in the context of match
, but it should work the same way as _
.
thelonious commented
Hmm, seems to be fine now. It must have been a copy/paste error on my part. My apologies.