Parser should accept parens when declaring rules
Closed this issue · 7 comments
The parser only accepts
[
[[rule ?e ?v]
[?e :ns/attr ?v]]
]
but it should also accept
[
[(rule ?e ?v)
[?e :ns/attr ?v]]
]
Hmm, maybe I take this back… the parser accepts parens for rule invocation, but it looks like the convention of using parens is only at invokation and not at declaration.
yes that's what I understand from my really poor knowledge of Clojure!
For rule invocations within rule declarations,
[
[[rule ?a ?c]
[?a :ns/attr ?b]
(rule ?b c)]
]
is required.
Maybe there’s a easy change to the parser combinators to allow either parens or brackets for rules.
I'll look at it!
On Fri, Feb 22, 2013 at 4:13 PM, Daniel James notifications@github.comwrote:
For rule invocations within rule declarations,
[
[[rule ?a ?c]
[?a :ns/attr ?b](rule ?b c)]]is required.
Maybe there’s a easy change to the parser combinators to allow either
parens or brackets for rules.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-13947712.
Daniel can you look at the test I added because it seems to work already...
You’ve tested rules of the sort:
[[[rule ?a ?c]
[?a :ns/attr ?b]
(rule ?b c)]]
but I don’t think it accepts
[[(rule ?a ?c)
[?a :ns/attr ?b]
(rule ?b c)]]
I can’t find anything concrete, but it seems most people write the former, but I don’t think the latter is wrong, and nor is:
[[[rule ?a ?c]
[?a :ns/attr ?b]
[rule ?b c]]]
So the first is accepted, are there tests for the second two?
Ok I see now what you mean!
I'm going to correct this ;)