8 Evaluation
This library provides facilities for evaluating Datalog. It can be required via:
(require (planet jaymccarthy/datalog:1:1/eval)) |
current-theory : (parameter/c mutable-theory/c) |
The theory used by eval-program and eval-stmt.
(eval-program p) → void |
p : program/c |
Evaluates p using (current-theory) as the theory, printing query answers as it goes.
This will raise a syntax error if given an assertion of a clause that is not a safe-clause?.
Examples: | |||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
string:1:0: datalog: Unsafe clause in assertion in: | |||||||||||||||||
"path(X, Y) :- edge(X, a)." |
(eval-statement s) → (or/c void (listof literal?)) |
s : statement/c |
Evaluates s using (current-theory) as the theory.
This will raise a syntax error if given an assertion of a clause that is not a safe-clause?.
Examples: | |||||||||||||
| |||||||||||||
(#s(literal (string 1 0 1 10) path (#s(constant (string 1 5 6 1) a) #s(constant (string 1 8 9 1) b)))) | |||||||||||||
| |||||||||||||
string:1:0: datalog: Unsafe clause in assertion in: | |||||||||||||
"path(X, Y) :- edge(X, a)." |
(eval-program/fresh p) → immutable-theory/c |
p : program/c |
Evaluates p in a fresh theory and returns the final theory, printing query answers as it goes.
This will raise a syntax error if given an assertion of a clause that is not a safe-clause?.
Examples: | |||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
| |||||||||||||||||
string:1:0: datalog: Unsafe clause in assertion in: | |||||||||||||||||
"path(X, Y) :- edge(X, a)." |