You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Admittedly my logic programming is not very good, but I was wondering if it is possible to create an infix rule like this:
range[a, b, x]
where a and b are integers defining a closed interval in Z and x can be any integer within the interval. The most straightforward implementation is this one:
range[x] := x = 0
range[x] := range[y], x = y + 1, x <= 10
?[x] := range[x]
where a = 0 and b = 10. But as you can see, I need to hardcode a and b and I can't really have the range[a, b, x] rule as I originally stated. Is this an inherent limitation of Datalog? I'm thinking this can probably be implemented as a custom fixed rule that takes parameters a and b, but I wonder if something like this could be done only using CozoScript.
Thanks in advance and congrats on the project, I think it's really cool.
The text was updated successfully, but these errors were encountered:
What you are asking for is infinite relations: as a and b are bindings, the relation represented by range must be (at least conceptually) infinite. This has been studied in the academic literature as an extension to Datalog, but I am not aware of any practical Datalog implementation that supports it.
However, writing it in the following way is perfectly acceptable in CozoScript:
range[x] := x = $lower
range[x] := range[y], x = y + 1, x <= $upper
?[x] := range[x]
and at query time you can pass in $lower and $upper as parameters. Does this work for you?
Hello!
Admittedly my logic programming is not very good, but I was wondering if it is possible to create an infix rule like this:
where
a
andb
are integers defining a closed interval inZ
andx
can be any integer within the interval. The most straightforward implementation is this one:where
a = 0
andb = 10
. But as you can see, I need to hardcodea
andb
and I can't really have therange[a, b, x]
rule as I originally stated. Is this an inherent limitation of Datalog? I'm thinking this can probably be implemented as a custom fixed rule that takes parametersa
andb
, but I wonder if something like this could be done only using CozoScript.Thanks in advance and congrats on the project, I think it's really cool.
The text was updated successfully, but these errors were encountered: