Skip to content
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

Metarules #54

Open
alex-dixon opened this issue May 21, 2017 · 0 comments
Open

Metarules #54

alex-dixon opened this issue May 21, 2017 · 0 comments
Labels
Projects

Comments

@alex-dixon
Copy link
Contributor

While brainstorming solutions for #45 I thought about using rules to program rules.

Suppose we had the following metarule that operates over something like our DSL's AST:

(meta-rule 
  [[?rule ::special-form/entity ?ref]]
  [[?ref :arg-1 ?arg-1]]
  [[?rule ::rhs/inserted-bound-variable ?e]]
  [[?result <- (acc/all :e) :from [?arg-1 :all]]]
  =>
  (insert [(guid) :your-entity-result ?result])

Here, as in other approaches to solving #45, there's an issue with "handing back" any result we would generate at the framework level to the user. Part of this seems related to the inability to distinguish a fact's identity given syntax alone. For #45 we may resolve this by requiring users to supply an attribute that acts as a kind of callback. Seems we need to know what attribute to assign the list value to, and the user needs to know that as well so they can grab it.

Anyway. These are merely thoughts for now, but exciting ones given that the resolution for #45 may entail dynamic rule generation. Combined with the rule-registry we already have, metaprogramming with rules seems not so far out of reach.

@alex-dixon alex-dixon added this to Backlog in Roadmap Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Roadmap
Backlog
Development

No branches or pull requests

1 participant