(cc'ing the list)

Cool, I hadn't seen that library. I think this approach would get the job
done.

Thanks,
Sam Caldwell

On Wed, Oct 26, 2016 at 12:25 PM, Sam Caldwell <[email protected]> wrote:

> Cool, I hadn't seen that library. I think this approach would get the job
> done.
>
> Thanks,
> Sam Caldwell
>
> On Tue, Oct 25, 2016 at 10:33 AM, Dupéron Georges <
> [email protected]> wrote:
>
>> Sam, would something like this work for you?
>>
>> I'm using the generic-syntax-expanders library to easily define expanders
>> (sorts of macros) which are expanded within uses of a wrapper of
>> define-judgment-form.
>>
>>
>>
>> #lang racket
>>
>> (require (rename-in redex
>>                     [define-judgment-form orig:define-judgment-form])
>>          generic-syntax-expanders)
>>
>> (define-language L
>>   (E number (+ E E)))
>>
>> (define-expander-type judgment-form)
>> (define-syntax (define-judgment-form stx)
>>   (syntax-case (expand-all-judgment-form-expanders stx) ()
>>     [(self . rest)
>>      (with-syntax ([new-self (datum->syntax #'here
>>                                             'orig:define-judgment-form
>>                                             #'self
>>                                             #'self)])
>>        (datum->syntax #'here
>>                       `(,#'new-self . ,#'rest)
>>                       stx
>>                       stx))]))
>>
>> (define-judgment-form-expander where/not
>>   (λ (stx)
>>     (syntax-case stx ()
>>       [(_ pat tm)
>>        #'(side-condition ,(not (redex-match? L pat (term tm))))])))
>>
>> (define-judgment-form L
>>   #:mode (j I)
>>   [(where/not number E)
>>    ---------------------
>>    (j E)])
>>
>> --
>> 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.
>>
>
>

-- 
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.

Reply via email to