-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rules that pass when finding facts, or give an error otherwise #88
Comments
Well you should be able to wrap the entire condition block in a Otherwise you'd need to generate a surrogate fact after the positive match and then have a rule generating errors on the absence of those surrogate facts, which would quickly get pretty cumbersome to declare unless you find a generic pattern you can use. |
I ended up writing an
After ingesting the rules and facts into my engine, I then just iterate through the productions and check which ones have tokens (pass) vs not (fail):
|
I need to run a ruleset, and for each rule that doesn't pass, I need to know why (via error message). Is it possible to implement rules which pass when finding facts, but generate an error when they don't? At first I thought it was a simple as this:
But after scratching my head for a while, I eventually learned that this will throw an error if the
forall
finds those facts. I could negate the conditions in theforall
, but I'd really rather have the conditions in the positive, since I feel like it reads better.Any ideas?
The text was updated successfully, but these errors were encountered: