Hi,<br><br>I'm trying to match form declarations that can contain optional keyword-followed-by-something (more precisely matching "defforms" declarations).<br>It looks like (id [#:kw1 val1] x [#:kw2 val2] ....) where the [] means optional.<br>
For example the list to match may be '(a b) or '(a #:kw1 1 b) or '(a b #:kw2 2) or '(a #:kw1 3 b #:kw2 4), etc.<br><br>But I couldn't figure out how to say "match 2 things one after the other, 0 or 1 time".<br>
Something like that could do it:<br>(match L<br> [`(,id ,@(list '#:kw1 v1) ... ,x ,@(list '#:kw2 v2) ... ....)<br> ....])<br><br>but nothing I tried got close to it (the ... are quoted and don't like being unquoted).<br>
Google gave me that result:<br>
<a href="http://stackoverflow.com/questions/7061533/match-form-in-racket-scheme-question-about-matching-sequences">http://stackoverflow.com/questions/7061533/match-form-in-racket-scheme-question-about-matching-sequences</a><br>
but that's not really what I'm after.<br><br>
Is there any way to do that with match patterns without doing some recurrence over `match' myself (and not writing all the possible composition of with/without each keyword)?<br><br>Thanks,<br>Laurent<br><br>