panda(jessica) .
bear(koko) . panda(lei) .
panda(micha) . bear (harry) .
panda(momo) .
bear(ben) . bear(ray).
hasil setelah diprogram di prolog :
Warning: (c:/documents and settings/mulyono/desktop/hasil.pl:2):
Clauses of panda/1 are not together in the source-file
ERROR: c:/documents and settings/mulyono/desktop/hasil.pl:3:15: Syntax error: Operator expected
Warning: (c:/documents and settings/mulyono/desktop/hasil.pl:5):
Clauses of bear/1 are not together in the source-file
% c:/Documents and Settings/Mulyono/Desktop/hasil.pl compiled 0.00 sec, 1,940 bytes
Welcome to SWI-Prolog (Multi-threaded, Version 5.4.7)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
For help, use ?- help(Topic). or ?- apropos(Word).
1 ?- panda(momo).
Yes
2 ?- bear(koko).
Yes
3 ?- panda(koko).
No
4 ?- bear(momo).
No
5 ?- panda(X).
X = jessica ;
X = lei ;
X = micha ;
X = momo ;
No
6 ?- bear(Y).
Y = koko ;
Y = ben ;
Y = ray ;
No
7 ?- panda(Y).
Y = jessica ;
Y = lei ;
Y = micha ;
Y = momo ;
No
8 ?- bear(X).
X = koko ;
X = ben ;
X = ray ;
No
9 ?- panda(Y), bear(X).
Y = jessica
X = koko ;
Y = jessica
X = ben ;
Y = jessica
X = ray ;
Y = lei
X = koko ;
Y = lei
X = ben ;
Y = lei
X = ray ;
Y = micha
X = koko ;
Y = micha
X = ben ;
Y = micha
X = ray ;
Y = momo
X = koko ;
Y = momo
X = ben ;
Y = momo
X = ray ;
No
10 ?- listing(panda).
panda(jessica).
panda(lei).
panda(micha).
panda(momo).
Yes
11 ?- listing(bear).
bear(koko).
bear(ben).
bear(ray).
0 comments:
Post a Comment