summaryrefslogtreecommitdiff
path: root/example.pl
blob: 74387b1548e3a0f2cd41736fca17aaab8720f98a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
:- dynamic(math/4).

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

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

true.

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}.

=(A,A).

length([], zero).
length([Head|Tail], suc(Length)) :-
	length(Tail, Length).

:- initialization(could_be_friends(bob, sam)).

:- initialization(length([a,b,c,d], Len)).

:- initialization(length(_,_)).