RelationalAI-oss / Rematch.jl

Pattern matching
Other
52 stars 6 forks source link

Negated matching #6

Open mbravenboer opened 6 years ago

mbravenboer commented 6 years ago

It would be useful to support negated matching, probably using !

Variable bindings get a little more tricky here. Obviously variables in a negated context should not bind, but this can be arbitrarily nested (like !(p(x) && q(x)), so we need to track whether we're in a positive or negative context. Double negation switches back to positive.

Judging from a quick code review this should be fairly easy to implement.