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

Recursive rules fail in new version of posh #23

Open
Conaws opened this issue Mar 21, 2017 · 1 comment
Open

Recursive rules fail in new version of posh #23

Conaws opened this issue Mar 21, 2017 · 1 comment

Comments

@Conaws
Copy link

Conaws commented Mar 21, 2017

This worked in posh 3.5

(def prereqs-rule
  '[[(prereqs ?e ?p)
     [?e :node/prereqs ?p]]
    [(prereqs ?e ?p)
     [?e :node/prereqs ?p1]
     (prereqs ?p1 ?p)]])

(posh/q conn '[:find [?p ...] 
                             :in $ % ?item
                             :where (prereqs ?item ?p)]
                prereqs-rule
                1)

In posh 5, the equivalent

(posh/q '[:find [?p ...] 
                             :in $ % ?item
                             :where (prereqs ?item ?p)]
                conn
                prereqs-rule
                1)

This produces an error of

#error {:message "Cannot parse rule-expr arguments, expected [ (variable | constant | '_')+ ]", :data {:error :parser/where, :form (prereqs $ ?p ?e ?var3284835)}}

@metasoarous
Copy link
Collaborator

Somehow I missed this message;

I think back in 3.5, either it was just always rerunning things when rules are involved, or it was actually doing the wrong thing, or it was doing something stupider than what it's doing now (since then, the pattern engine has been rewritten). The specific error here has to do with the query parsing, which is maybe an easy fix (in fact, based on the error message, you might want to try just switching :where (prereqs ?item ?p) to :where [prereqs ?item ?p], which should be valid DS). However, the underlying probably will persist I believe (you're welcome to test out).

Again, fixing rules may be more of a mess than its worth, given other things on the horizon. You're welcome to try and prove me wrong though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants