I'm considering putting in some effort to generalize the binding construct in 
for-clauses so that we can have for[*]/match/X macros. This will require 
modifying and exposing define-for-variants (due to circularity in requiring 
match in for). Does anyone object? I'll of course need the code reviewed by 
those more familiar with for, but I'm hoping I don't need to mess with 
complicated implementation details such as taints.

Example:
Here the significantly new behavior is that name should match in the for/match 
clauses in order to run the body.

(for* ([mch (redex-match L some-pat some-term)]
       [bnds (match-bindings mch)]
       [use-names (in-value use-names)])
  (for/match ([(bind name exp) bnds]
              [name use-names])
    ...code...))

What this looks like without for/match is

(for* ([mch (redex-match L some-pat some-term)]
       [bnds (match-bindings mch)]
       [use-names (in-value use-names)])
  (for ([bnd bnds]
        [name use-names]
        #:when (match* (bnd name) [((bind nm _) nm) #t] [(_ _) #f]))
    (match-define-values ((name exp) name) (values bnd name))
    ...code...))

Notice the unnecessary second match.

-Ian
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to