Why not write it like it’s written in English? It could be one less thing to learn for people trying to adopt the language.
Why not write it like it’s written in English? It could be one less thing to learn for people trying to adopt the language.
From a principled point of view, the rule "a :- b, c" helps define what "a" means, and it seems, in practice, most helpful to be able to quickly visually identify the rules that define a certain relation. The list of premises tends to be of secondary importance (in addition to often being longer and more complicated).
From a practical point of view, we wrote Dusa as people familiar with existing Datalog and Answer Set Programming languages, which use the backwards ordering and ":-" notation, and some of the core target audience we hope to get interested in this project is people familiar with those languages, so we made some syntax choices to make things familiar to a specific target audience. (Same reason Java uses C-like syntax.)
You can also think the same way about functions in typical languages: we don't write the body of the function first and then assign it to an identifier.
f(X) :- g(X), h(X).
f(a).
With those two statements, `f(a)` is true, but it does not mean that `g(a)` and `h(a)` are also true. Instead, it means that we happen to know some fact, `f(a)`, and some rule for cases beyond that fact. If it also happened that `g(a)` and `h(a)` are true then we'd have two ways of arriving at the fact of `f(a)` being true.It's a reverse of the implication arrow and is meant to be read that way:
f(X) :- g(X), h(X).
Is read as "f(X) if g(X) and h(X)", versus "if g(X) and h(X) then f(X)".if (want: edge Y X) { search for: edge X Y }
This is searching in reverse compared to a different if statement:
if (have: edge X Y) { assert: edge Y X }