shithub: pprolog

ref: 8dd4f85c85aa9ab7a5f1219efd694e6707f2718c
dir: /example.pl/

View raw version
math(A,B,C,D) :- D is A + B + C * A.

parentest :-
	1 + 2 * 3 + 4.
parentest :-
	(0 * (1 + 2) * 3) * 3 + 4.

likes(bob, ice).
likes(sam, text).
likes(sam, ice).

could_be_friends(Person1, Person2) :-
	likes(Person1, Thing1),
	likes(Person2, Thing2),
	Thing1 = Thing2.

list1(A) :- A = [1,2,3,4].
list2(A) :- A = [a,b|c].

curly(A) :- A = {one,two,three}.

tester(A, B) :- !, A = B.
tester(A, B) :- true.


thrower(_, 10).
thrower(_, 20).
thrower(inner, _) :- throw(number(30)).
thrower(outer, _) :- throw(hehe).
thrower(_, 100).

throwtest(Type, L) :-
	catch(
		catch((thrower(Type, N), L=N), number(N), L=N), 
		Other, 
		L=outer_exception(Other)
	).