jan's home page
logic programming
next
latest
Prolog in Javascript
# Enter your ruleset in here. father(tom, mary). father(dick, tom). father(george, dick). mother(mary, jan). parent(X, Y) :- father(X, Y). parent(X, Y) :- mother(X, Y). ancestor(X, Y) :- parent(X, Y). ancestor(X, Y) :- parent(X, Z), ancestor(Z, Y). # Some list-processing stuff... append([], Z, Z). append([A|B], Z, [A|Z2]) :- append(B, Z, Z2). reverse([], []). reverse([A|B], Z) :- reverse(B, Brev), append(Brev, [A], Z). # Broken parsing bits... rule1(a, b,
, d). rule1(a, b, "a string", d). # This next one doesn't work at the moment - see line 389 # and improve the regexp code if you like. #rule1(a, b, "a string with \" embedded", d).
Enter your query:
helloeNumber: