Unfortunately, Redex's pattern language does not currently support
`not`. It might be easy to add it, or maybe hard, or maybe impossible.
Offhand, it seems probably possible to support in the unifier and
impossible in the enumerator and not hard in the matcher.

In the meantime, consider using a metafunction with an `else` clause.

Robby


On Mon, Oct 24, 2016 at 5:15 PM, Sam Caldwell <s...@ccs.neu.edu> wrote:
> I have a Redex judgment that I would like to specify in terms of a *failed*
> pattern match. I can write this like so:
>
> [(side-condition ,(not (redex-match? L pat (term tm)))
> ------------------------------------------------------------------
> ...]
>
> which works, but I would rather just abbreviate this using a macro (since
> afaict there are no existing constructs in redex to do this), so I could
> write for instance:
>
> [(where/not pat tm)
> --------------------------
> ...]
>
> But then I get an error: "define-judgment-form: expected judgment form name
> in: where/not"
>
> Does anybody know how to achieve this?
>
> Thanks,
> Sam Caldwell
>
> Full example:
>
> ==============================================================
>
> #lang racket
>
> (require redex)
>
> (define-language L
>   (E number (+ E E)))
>
> (define-syntax (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 racket-users+unsubscr...@googlegroups.com.
> 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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to