8/6/2019 daprogramebis paradigma
1/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
118
*, **
*., , 0128,. 1.
**, , 0193,.7.
.
,
.
.
, , . ,
LISP-,
, -.
I. " " :
" - , , , , " [1]. - .
"" ,
" ". ,
. (, ). , . , .
"" (R.W.Floyd) 1979 . , ,
, , . : "
8/6/2019 daprogramebis paradigma
2/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
119
, , " [1]. , , ,.
" " . . : (D.D.Spinellis) : " "" () , () " (: "Theword paradigm is used in computer science to talk about a family
of notations, that share a common way for describing program
implementations). (D.G.Bobrow) ", ". (Bruce Shriver) "", (Linda Friedman) - " ". (PamelaZave) _ " . (:"way of thinking about computer systems".)
(Peter Wegner) . , " , ". (T.A.Budd) "", " , , ,, ".
, (), . , , .
,
. _ , , . , , , .
- , .. H (holy war -, ). , - , , .
8/6/2019 daprogramebis paradigma
3/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
120
:o ,o ,o ,o .
- - 50 , . . .
: , , . - . , . . , . , . . Fortran . Pascal- C-, Sisal. ,
. , . .
, , , . , , (Literate programming, )[2]. (Donald Knuth) 1981 TeX - , . , , .
Pascal- Algol- , LISP -ML, Miranda, Sceme. CJava.
8/6/2019 daprogramebis paradigma
4/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
121
. LISP- [3,4,5,6] : , , ,
, , , . LISP-, , . , .
. . : -,, - , - .
""
(-
-)
(--
)
---
---
_ /
. ,
, , , , , . C-pascal-, , , .
. . , , .
_
8/6/2019 daprogramebis paradigma
5/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
122
. . . .
., , . G- .
() , . , . . , . . , , "" (), .. .
" " " " (. lazyevaluation) , , . , . , " ". , , , , (Software Prototyping),
, -.
. ., , . , ,.
-, -- . -
8/6/2019 daprogramebis paradigma
6/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
123
. - - , , - . - , () .
, .
. . :
; ;
; ; (, , ,
, ); ; ; ; .
, , ,. :
; ; .
, .
,
. , :
.
: , , Python, .Generic programming-
, to-be-specified-later( ) . , , .
8/6/2019 daprogramebis paradigma
7/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
124
Ada, 1983 . Eiffel, Java, C #, Visual Basic.NET Haskell, C++ , (1994 .)
C++ - - . C++ - , . , "".
: , , ,, .
C++ - . .
, , . , .
C++ -throw -,trycatch.
,
. : ,, . C++- , .
STL (StandartTemplate Library), , .STL .
STL-?STL .
. , . () .
8/6/2019 daprogramebis paradigma
8/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
125
, ().:(vector) - . (
). . :
(deque) - (double-ended queue) , . :
(list) - , , , . ( , , ).. . ,
.:
: (set) - , () ( ). STL "" (multiset), . , ,
( ). , . :
(map) - , "-". , . "" (multimap)
8/6/2019 daprogramebis paradigma
9/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
126
. :
II.
, . , - , (, ,
), :
. , . /, . , (,):
= 012. . .n = /
, , , , , . .
, , : v = E v := E, v , E-. . - (;). , , if while, () ., . ., , , .
. , ,
, .
8/6/2019 daprogramebis paradigma
10/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
127
, () .
, ,. ,
, , /
= f ()., : Output = Program(Input). : , f.,.
, . , - . , , . , , , , . , . , , , , : , , .
() , , , . . C- , , . FORTRAN .
. C -
:int fact (int n)
{ int x = 1;
while ( n > 0 )
{ x = x * n;
n = n - 1;
}
return x;
}
LISP-:( define fact ( lamnda ( n ) ( cond (( eq n 0) 1)
( t ( fact ( n -1 ))))) ), C-
, .
8/6/2019 daprogramebis paradigma
11/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
128
, ,
, , .
, , . , , FORTRAN - .. , . . , . , , , , . . FORTRAN - , .
, , , , . , , , , .
, , . , , , . . , . , ( ), .
(, whileTRUE do x:=x),, , , .,, . , , goto, C break continue, , . , (continuations).
, , (Martin C. Henson) " ".
8/6/2019 daprogramebis paradigma
12/32
8/6/2019 daprogramebis paradigma
13/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
130
, . - , . , . , , , ,
, . + 0, - * 1. D -
. , , , .
, . , , . .
[7]:
, ;
; ; ;
(.. );
(..), .
, , Objective Caml [8], INRIA- (,).
III.
, , , . , .
, ,
,, ,
8/6/2019 daprogramebis paradigma
14/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
131
.
, , , .
C++ java , - . , .
. "" LISP , , , , , . "" LISP -, . , . LISP- ( 1962 ) , . -20- 70-80 -, : LISP,-.
LISP-, , - . ,
.LISP- ,
, VAX, . LISPLISP-.
LISP , , , ..
-
, , . . , , .
, , , .
, , . (
8/6/2019 daprogramebis paradigma
15/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
132
, , . ( ). , ,
,. , ,
. . , , .
, , LISP .
(LISP-) . , , .
()LISP- [9].
, ,:
LISP-:
(A (A1(A11(...)A12(...)...A1m(...))(A2(A21(...)A22(...)...A2m(...))
...
(Ak(Ak1(...)Ak2(...)...Akm(...)))
, : :
8/6/2019 daprogramebis paradigma
16/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
133
AE . , , , , . , , , .
AE LISP-:(A(E1(A1(E11(A11(...))(E12(A12(...))...(E1m(A1m(...))))(E2(A2(E21(A21(...))(E22(A22(...))...(E2m(A2m(...))))
...
(Ek(Ak(Ek1(Ak1(...))(Ek2(Ak2(...))...(Ekm(Akm(...)))))
, , .. AES. , , . (S Akm)-. ( S),
. AES:
AEVLISP-:
( A(V A)(E1(A1(V A1)(E11(A11...))(E12(A12(V A
12)...))
... (Em(A1m...)) ))
(E2(A2...))...
(Ek(Ak)) )
, . , ().
, , , .
:1. , ,
:
8/6/2019 daprogramebis paradigma
17/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
134
., :
( ( ()))( ( ()))
2. , :
, :( ( - ( ))) ( ( - ( )));( ( ( ))) ( ( - ( )))
3. :
, ( ( - ( ))) ( ( )).4.:
5. :
, , ,
.
8/6/2019 daprogramebis paradigma
18/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
135
: A,Ak,Ap,An,Am,Ck, E,Ek,Em,En , .
LISP-.
: , , , , .
AE AEV ..
, :-, , , , , :
(- (S ( )( ) )
((S ( *)(: 5 5000 ) )
((S 800 ) ) )
((S ( *)(: 10000 * ) )
((S 1000000 ))
((S 300000 ))
( ( S (* ) (: 1000 10000)
( ))
((S))
AE
. . , (,..) .
()
, ( ). , , .. 33 .
( ( ( ( ))( ( ( ( ( ( ( ( ( ))) ))) )))
( ( ( ( ( ( ))) ))) )( ( ( )))( ( ( ))
( ( (* ( ))( ( () ))
8/6/2019 daprogramebis paradigma
19/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
136
( ( () )) )))( ( ( ( () )))
( ( ( ( ( () ))) ))( ( ( ( () ))) ))
( ( ( ( ( ( ( () ))) )))
( ( )))( ( ( ( )))( ( ( ( ))) )( ( ( ( ))) ))
( ( ( ( ( ( ( ( ))) ))) ))( ( ( ( )))
( ( ( ( ( ( ))) ))) )( ( ( ( ( ))) )
( ( ( ( ( ( ))) )))( ( ( ( )))
( ( ( ( ( ( ( ( ))) ))) )))( ( ( ( ( ))) ))( ( ( ( ( ))) )
( ( ( ))) )( ( ( )))( ( ( ( ( ))) ))( ( ( ( )))
( ( ( ( ))) )) )( (* ( ( ( ( ))) ))
( ( ( )) ) )) (English
Georgian Dictionary), 50000 . , , ,
, . , : , ,, , . :
*-, ,, ; , , .
8/6/2019 daprogramebis paradigma
20/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
137
, , ( , )., , _ - . , 6 - , . , : , . (, 5 : . : , ,, - .
, . ( ) . , .
, , , , , , , .
.
(, ) (, ). . -
, , , .
, , . . , . , , ,
.
8/6/2019 daprogramebis paradigma
21/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
138
, - ( ), LISP-.
. ,
[10]: ,. : , , .
: ,, .
: ,, .
, (), ; () .
, , : :A B D C E G F H J
:D B A G E C H F J
:D B G E H J F C A
, , . .
: . , , , . , ( ).. :
8/6/2019 daprogramebis paradigma
22/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
139
:A - ,
B C - ,D E F ,G H J - .
, , ().
() :
;
. ,
.[11]- LISP- , .. Map-
mapcar . ,(mapcar 'list '(a b c))'((a)(b)(c)).
:
(mapcar )
mapcar : , .. ().
LISP- ,
Map- , . , , .
[12,13] - . , , .
, . ,
8/6/2019 daprogramebis paradigma
23/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
140
, .
, . -.
,
, ,., -
. - . . , .
, , () ,. .
.,
, , . -, . , : .
S- : , ,
. , ;
, .
, ,.
,
:
nil
nil--\-. (cons 'a nil). (b a)
.
8/6/2019 daprogramebis paradigma
24/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
141
(a) (a.nil)
(a b c) (a.(b.(c.nil)))
Lisp- [14]. ,
, . , , ( 16 32 ).
, .
Lisp- ( , IBM PC), , .
. Lisp-: ; Lisp-; (tagged architecture); Lisp-.
, , , L LISP-lisp-.
-
, .
LISP . , LISP ,.
, LISP (LISP isa programmable programming language).LISP- [11]. , , .
, LISP- .. . LISP-. ,
, . , , , ,
8/6/2019 daprogramebis paradigma
25/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
142
, .
, . , / .
, , .
, LISP- , , . , , -, , , ,lambda, .
:
(car '(lambda (x)(list x))) lambda ; ((lambda (x)(list x)) car)(car) ;
LISP- map-, () (map) , . map-map-, :
(MAPx fn l1 l2 ... lN), l1 ... lN-, fn- N
.
, map- -, fn- : (MAPx fn). MAPx : mapcar, mapcan, maplist, mapcon..
. , (mapcar,mapcan) , (maplist, mapcon). ,
. mapcar
. ,(mapcar 'list '(a b c)) '( (a) (b) (c) ). mapcan mapcar , ncons., (mapcan 'list '(a b c))'( a bc ).
maplist . , (maplist 'list '(a bc)) '(((a b c))((b c))((c))). mapcon maplist- ,
8/6/2019 daprogramebis paradigma
26/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
143
ncons. ,(mapcon 'list '(a b c))'((a bc)(b c)(c)).
:(mapc 'list '(a b c))'(a b c).(mapl 'list '(a b c))'(a b c).
Clisp- : Mapc,Mapcan, Mapcar, Mapcon, Mapl, Maplist. LISP- - Objective CAML . Objective CAML- , . . , .
.
:
(); ;
(lambda ); ;
, ;
;
, . , map- ,
( ), ( ). , map- "". , . , map- , . , , , _ .
map-, , . , .
8/6/2019 daprogramebis paradigma
27/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
144
, map- "" . ,map-, , (
), , . map- .
. , , LISP- . , , , . . ,, , . (, , ). , , , .
, , , . , .
, LISP-,
, . - . map-, (, ). map- .
. . , . . . _ , .
LISP (Lisp is a programmableprogramming language), ,
8/6/2019 daprogramebis paradigma
28/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
145
. , LISP-, .
, , . ,
LISP- .
. , , .
, , , . , . , , . , , . . .
LISP- . - .. - [15].
. , .
[15]-. ,.
LISP- , , :
(DEFUN CLASSES (CL)
(COND (CL (CONS (CDAR CL) (CLASSES (CDR CL)))) )); ; Nil
(DEFUN ARGUM (CL) (COND
(CL (CONS (CAAR CL) (ARGUM (CDR CL)))) ))
; ;
(DEFUN DEFMET (FMN C-AS EXPR)
(SETF (GET FMN 'CATEGORY) 'METHOD)
(SETQ ML (CONS(CONS(CONS FMN (CLASSES C-AS))(LIST 'LAMBDA (ARGUM C-AS) EXPR) ) ML))
FMN )
8/6/2019 daprogramebis paradigma
29/32
8/6/2019 daprogramebis paradigma
30/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
147
, -f1 f2 ...( ). :
(setf (make-instance 'ob))
:
(setf (slot-value c) 1223).
., . . .
, , Lisp-.
, . . .
, , . .
Objective Calm,
INRIA- ( ,). Objective Calm- C-. , ,. .
. , :
let o f g = fun x -> f ( g x )
, .
o- ? Objective CAML-., o-
, , : o -
(fun; o - (); gf(
);
o-, f;
8/6/2019 daprogramebis paradigma
31/32
Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)
148
o - , g .. ,
. ObjectiveCAML- .
, . - . - P.
.
, , . , . , , CFortran,, -,, C++-. , , Objective CAML . (, ) ,.
, ,
. , : , , -. , . , .
, , . , ,
.
8/6/2019 daprogramebis paradigma
32/32