-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.pl
More file actions
44 lines (38 loc) · 1.05 KB
/
Copy pathdatabase.pl
File metadata and controls
44 lines (38 loc) · 1.05 KB
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
37
38
39
40
41
42
43
44
% Animals Database
animal(mammal, tiger, carnivore, stripes).
animal(mammal, hyena, carnivore, ugly).
animal(mammal, lion, carnivore, mane).
animal(mammal, zebra, herbivore, stripes).
animal(bird, eagle, carnivore, large).
animal(bird, sparrow, scavenger, small).
animal(reptile, snake, carnivore, long).
animal(reptile, lizard, scavenger, small).
person(john, smith, 45, london, doctor).
person(martin, williams, 33, birmingham, teacher).
person(henry, smith, 26, manchester, plumber).
person(jane, wilson, 62, london, teacher).
person(mary, smith, 29, glasgow, surveyor).
allmammals :- animal(mammal, X, _, _),
write(X),
write(' is a mammal'), nl,
fail.
allmammals.
all(X) :- animal(_, Name, X, _),
write(Name),
write(' is a '),
write(X), nl,
fail.
all(_).
alltil :-
animal(T, X, F, C),
write(animal(T, X, F, C)),
nl,
X=sparrow,
!.
professions(X) :-
person(_, _, Age, _, Work),
Age > X,
write(Work),
nl,
fail.
professions(_).