> (define-syntax (match-for stx)
That's nice.
Sometimes I wish I could do the general thing -- use `match` patterns
in the binding clauses for any `for`-family form.
I often do something like this:
(define xs (list (cons 1 2) (cons 3 4)))
(for ([x (in-list xs)])
(match-define (cons a b) x)
(use a b))
Instead it would be nice to write:
(for ([(match-define (cons a b)) (in-list xs)])
(use a b))
Or even just:
(for ([(cons a b c) (in-list xs)])
(use a b))
In the grammar, `id` becomes `id-or-match-pattern`.
On the other hand, this would only really help in simple
`match-define` destructuring -- as opposed to using `match` to handle
variations in the data. And although I do the former a lot, I do the
latter even more.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.