?- ronri(X), learn(X).
true. X = you█
Logic Programming in the Browser
Facts, rules, queries, and clause notation
% Facts are ground terms
likes(mary, food).
likes(mary, wine).
% Rules define relationships
likes(john, X) :-
likes(mary, X).
% Queries test the knowledge base
?- likes(john, food).
true.
Built-in and user-defined predicate definitions
% User-defined predicates
mortal(X) :- human(X).
human(socrates).
% Query with unification
?- mortal(Who).
Who = socrates.
Arithmetic, list operations, and I/O primitives
% Arithmetic
?- X is 3 + 4 * 2.
X = 11.
% List operations
?- append([1,2],[3,4],L).
L = [1,2,3,4].
Unification, comparison, and control flow operators
% Unification
?- X = f(Y).
X = f(Y).
% Comparison
?- 3 > 2.
true.
% Control: cut
max(X,Y,X) :- X >= Y, !.
max(_,Y,Y).