I have a Racket list with some values (list 'foo 'bar 2 #t 42 9 2 'some)
. In reality these values follow some more specific pattern but for the question this is irrelevant. I want to test test if there are two identical values in the list, in this case the number 2, and get the element and the other elements. This is my attempt:
#lang racket
(match (list 'foo 'bar 2 #t 42 9 2 'some)
[(list-no-order a a rest ...)
"Do some stuff"]
[_ "Do some other stuff"])
The pattern is (list-no-order a a rest ...)
. But the interpretation of the program fails with:
a11: unbound identifier;
also, no #%top syntax transformer is bound in: a11
To me it looks an error when transforming the macro. If one changes list-no-order
to list
the pattern works but of course only if the elements are at the beginning of the list.
Is my pattern wrong, if so how to correct it or is the intended pattern not possible and what is the best way to work around it?
(match (list 2 2 #t) [(list-no-order asd asd dsa) "Do some stuff"])
: pastebin.com/K3PG44kY. We can see that there's an unbound idasd8
. Perhaps the macro is buggy? – Purapurblind