. , . (Prolog) (PROgramming in LOGic).
. . . 70- . () , , . , , . . . (). C&M Prolog . , 70- . ( ) .
, -, . , , , . , , , , . , .. , .
, , . , , , , .., , .
VisualProlog. VisualProlog : DOS, Windows 3.x, Windows 95/98, Windows NT, OS/2, SCO Unix, Linux. VisualProlog - . Visual Prolog ESTA.
|
|
3- :
1. .
. , ellen tennis :
likes(ellen, tennis).
, ellen tennis, , likes (). , . , , . . , likes .
2. .
, . .
:
A:- B1,..., Bn. (n>0)
A , Bi . :- .
:
- A , Bi;
- A, B1, B2,..., Bn
, , () .
, , :
likes(tom, football):- sport(football).
likes(tom, football) , . sport(football).
3. .
, .
, :
likes(ellen, tennis).
likes(tom, football).
likes(tom, swimming).
:
?-likes(tom, football)
yes
, .
, , , ellen, tennis, .. . . . . , , :
likes(bill, X):- likes(tom, X).
X , bill tom ( ). , , , : Bill.
. , (yes), (no). , . , :
?- likes(bill, What). % What
What, , :
What = football
|
|
What = swimming
2 Solutions
, . , - , , . : _. , - :
?- likes(tom, _).
yes
:
?- likes(ellen, tennis), likes(tom, tennis).
likes . . , . , - , :
?- likes(ellen, X), likes(tom, X).
X . , , .. .
() . . . , ( ) . :
1. .
2. ( ).
3. . : - , .
, . : , ( ) . . :
1. .
2. , .
3. , .
4. , () .
VisualProlog
VisualProlog 4- . .
(domains) . VisualProlog . :
short | 32768.. 32767 |
ushort | 0.. 65535 |
long | -2147483648.. 2147483647 |
ulong | 0.. 4294967295 |
integer | 32- -2147483648.. 2147483647 |
unsigned | 32- 0.. 4294967295 |
byte | 0.. 255 |
word | 0.. 65535 |
dword | 0.. 4294967295 |
char | , , : 'a' |
real | , double C |
string | 1. , , , : telephone_number. 2. , , : Visual Prolog. |
symbol | , . symbol string . . |
|
|
: