3GL   4GL   5GL  

Prolog

- , , .

: , , .

: , , .

, , .

- , , .

, 4 : {A..Z},{a..z}, {0..9},{+ - * / ^ < > ~ : . ? @ # $ &}.

. .

, :

- ,

- , .

, date(Day,,1999) date(Day1,,1999) , Day Day1 1 31.

1 .

, . , , , . .. , , .

, , .

. . , .

- .

, , . : a, "_", "this_is_atom".

, , . : V, _25.

C ( ) - , . , , .

( ) - .

. , , ( , ) .

, , : , : ( 1, , 2000 ) .

:

trace .

. , , :

GOAL

write("hello"),readchar(_).

, , , PREDICATES CLAUSES.

, GOAL . , , .

DOMAINS, PREDICATES, DATABASE CLAUSES. GOAL .

, , . DOMAINS , .

. . - :

+ ,

,

* ,

/ ,

mod ,

div .

- , [X ] , [1,2,3]. : X is ([l,2,3]+5) 6.

=:=, =\=, >, <, >= <= .

@ X@Y , Y , @.

. Y - , .

:

=:= Y Y

=\= Y Y

< Y Y

> Y Y

<= Y Y

>= Y Y

file = < 1>;...;

< N>

- .

filemode(SymbolicFileName,Mode) - ( Mode :

0 - Binary Mode,
1 - Text Mode). 

.

, , . , , . , , .

openread(SimbolicFileName,OSFileName) . , .

openwrite(SimbolicFileName,OSFileName) . . , . - , .

openappend(SimbolicFileName,OSFileName) . , .

openmodify(SimbolicFileName,OSFileName) . , .

, , existfile(OSFileName). . , , , , .

, .

"\", , , ("\\"). , "C:\Prolog\BIN", "C:\\Prolog\\BIN".

, closefile. . , . .

deletefile(OSFileName) , . - , .

renamefile(OldOSFileName, NewOSFileName) , , , . , , , , .

eof(SymbolicFileName) ( End Of File " ") , , . . . , , .

file_str(SymbolicFileName,String) , , , , . , , .

flush(SimbolicFileName) , , . .

.

, . , .

:

DOMAINS

< >=< >*

, , .

[monday, tuesday, wednesday, thursday, friday, saturday, sunday] , ;

["", "", "", "", "", "", ""] , ;

[1, 2, 3, 4, 5, 6, 7] , ;

['', '', '', '', '', '', ''] , ;

[] , .. , ( nil).

, :

  1. ([ ]) ;
  2. [H|T] , H ( , ), T , .

, .

, .

length([], 0). /*      */
length([_|T], L) :
length(T, L_T), /* L_T      */
L = L_T + 1. /* L      */

, ( , , ).

member(X,[X|_]). /* X     */
member(X,[_|T]) :
member(X,T). /* X   T*/

, . , .

conc([ ], L, L). /*       L   L */
conc([H|T], L, [H|T1]) :
conc(T,L,T1). /*     L,    */

:

  1. :
  2. ?-conc([1, 2, 3], [4, 5], X) X= [1, 2, 3, 4, 5]
  3. , , :
  4. ?-conc([1, 2, 3], [4, 5], [1, 2, 5]) No
  5. :
  6. :
last2([X],X). /*        */
last2([_|L],X):
last2(L,X). /*         */

, ( , , ).

reverse([ ],[ ]). /*      */
reverse([X|T],Z):
reverse(T,S), conc(S,[X],Z). /*           */

:

rev([H|T],L1,L2):
rev(T,[H|L1],L2). /*       */
rev([ ],L,L). /*    ,           */

, ( , , , , ).

n_element([X|_],1,X).
n_element([_|L],N,Y):
N1=N1,
n_element(L,N1,Y).

, .

is_list([_|_]).

, ( - , - ).

simple_list([],[]).
simple_list([H|List],List1):-
		is_list(H),			/*    ,*/ 
simple_list(H,List1).	/*    simple_list        */
simple_list([H|List],[H|List1]):-
		not is_list(H),		/*     ,*/
simple_list(List,List1). /*    simple_list      - */

, ( , , ).

delete_all(_,[],[]).
delete_all(X,[X|L],L1):
delete_all (X,L,L1).
delete_all (X,[Y|L],[Y|L1]):
X<>Y,
delete_all (X,L,L1).

, , :

delete_one(_,[],[]).
delete_one(X,[X|L],L):!.
delete_one(X,[Y|L],[Y|L1]):
delete_one(X,L,L1).

, ( , , ).

add(X, L, [X|L]). 

, , :

add(X, L, L):-member(X, L), !. add(X, L, [X|L]).

:

atom(X) -, X-.

integer(X) - , X-.

float(X) , .

compound(X) , .

atomic(X) - , X- .

var(X) - , X- .

nonvar(X) - , X- , ,
.

ground()- , .

number() - , .

string() , .

- , .. .

(), ().

:

assert(d) d ;

retract(d) , d;

asserta(d) - ;

assertz(d) - .

database.

            3GL   4GL   5GL  

, - - :
- - ;
- (obj) (dll).




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution