You are on page 1of 32

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.

2(19)



*, **
*. , , 0128,
. 1.
** , , 0193,
. 7.


.
,
.
.
,
, . ,
LISP- ,
, - .

I.

"
"

:
" - , , ,
,
" [1].
-
.

"" ,
" ".
,
.
(,


). ,
. ,
.
" "
(R.W.Floyd) 1979 . ,
,
, ,
. : "

118

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
, " [1]. ,
,
,
.
" " .
. :
(D.D.Spinellis) : " ""
() ,
() " (: "The
word 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) -
" ". (Pamela
Zave) _ " . (:
"way of thinking about computer systems".)
(Peter Wegner)
. , "
,
". (T.A.Budd) ""
, " , , ,
,
".
, ( )
, . ,


.
,
.
_ ,
, . ,

, , .
-
,
.. H (holy war , ) . , -
, ,

.
119

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)



:
o ,
o ,
o ,
o .
- 50
,
.
.

.

: , ,
.

- .
, .
.
,
.
,
.
. Fortran .

Pascal- C-,

Sisal.
,

.
, .

.
,
, ,
. , ,

(Literate
programming,

)[2]. (Donald Knuth)


1981 TeX -
, .
,
, .
Pascal- Algol-
, LISP -
ML, Miranda, Sceme . C Java.
120

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)



. LISP- [3,4,5,6]
:

, ,
,
, ,
,
.
LISP- ,
,
.
,
.

.

.
: -,
, - , -
.

""


()

( )

--

_
/


. ,
, , , ,
,
. C-
pascal-, , ,
.

.

.
, , .
_

121

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


.
.

.

.
, ,
.
G-

.
()
,
.
,
.

,
. .
, , "" ( )
, ..
.
" " " " (. lazy
evaluation) , ,
.
, .

, " ".
,
, ,
,
(Software
Prototyping),

, - .

.
.
, ,

. , ,
.
-
, - . -

122

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


. - , ,
-
. -
, () .
,
.


.
.
:
;
;
;
;
(, , ,
, );
;
;
;
.

,

,
,
.
:
;
;
.
,
.

,
. ,

:


.
: , , Python, .
Generic programming-
, to-be-specified-later
( ) .
, , .
123

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


Ada, 1983 .
Eiffel, Java, C #, Visual Basic.NET
Haskell, C++ ,
(1994 .)


C++ - - . C++ -
,
.
, ""
.
:
, , ,
, .
C++ -
.

.
,
,
.
,
.
C++ - throw - ,
trycatch.

,
. : , ,
. C++-
,

.
STL (Standart
Template Library), ,
.
STL .
STL -?
STL .
.
,
.

()
.

124

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


, (
).
:
(vector) - .
(
).
.
:

(deque) - (double-ended queue)


,
. :

(list) - ,
,
, .
( ,
, ).

.
. ,

. :

:
(set) - , ()
( ).
STL "" (multiset),
. , ,
(
).
, .
:

(map) - ,
"-". ,
. "" (multimap)
125

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)

II.


,
. , -
, (, ,
),
:
. ,
.
/, .
,

(, ):
= 0 1 2. . . n = /
,
, , ,
, .

.
, ,
: v = E v := E, v ,

E-.

.
- (;). , ,
if while,
() .
,
.
. , ,
,
.


. , ,
, .
126

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
()

.
, ,
. ,
, , / = 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, .
127

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)



, ,

,
.
, ,
.
, , FORTRAN - ..
,
.
. ,
.
, ,
,
, .
. FORTRAN -
,

.
,
, ,
, . , ,
, ,
.
, ,


. , , ,
.
.
,
.
, (

), .
(, while
TRUE do x:=x), , , , .
,
, .
, ,
goto, C break continue,
,
.
,
(continuations).
, ,
(Martin C. Henson) " ".
128

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


ML- .
.
[[X]] "X- " ,
, [[int]]=Z. , ML- fact,
:
let rec fact n =
if n = 0 then 1
else n * fact ( n - 1 )
fact
. ,
Z Z:
n !, n > 0
[[ fact ]](n) =
,

.
, ..
. , C-
rand(),
.

, , :
int rand ( void )
{ static int n=0;
return n=2147001325 * n + 715136305;}
,
, goto ,
.

. , ,

.
.

,
, .
,
,

. ,
.
, , LISP,
ML
,
. ,

, : .

129

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


, . -
, .
,
. , , ,
,
,
. + 0, - * 1. D
-
.
, ,
, .
,

. ,
,
.
.

[7]:
,
;
;
;
;
(..
);
(..
),
.
,
, Objective Caml [8],
INRIA- ( , ).
III.

, ,
,
.
,
.
,
,
,
, ,

130

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)



.
, ,
,
.
C++ java , .
,
.
. "" LISP
,

, ,
, , . "" LISP -
,
.
, .
LISP- ( 1962 ) ,
. -20- 70-80 ,
: LISP,
- .
LISP-, , -
.
,
.
LISP- ,
, VAX,
. LISP LISP .
LISP
, ,
,
. .

-
, ,
.

. , ,
.
, ,
, .
,
,
. (
131

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
, .
(
). ,
,
,
.
, ,
.
.
, ,
.
, ,
LISP .
(LISP-
) .
, ,
.
(
) LISP- [9].
, ,
:

LISP- :
(A (A1(A11(...)A12(...)...A1m(...))
(A2(A21(...)A22(...)...A2m(...))
...
(Ak(Ak1(...)Ak2(...)...Akm(...)))
,
: :

132

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


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 :

AEV LISP- :
( A(V A)(E1(A1(V A1)(E11(A11...))(E12(A12(V A12)...))
... (Em(A1m...)) ))
(E2(A2...))
...
(Ek(Ak)) )
,
. ,
(
).

, ,
,
.
:
1. , ,
:

133

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


.
, :
( ( ()))
( ( ()))
2. ,
:

, :
( ( - ( ))) ( ( - ( )));
( ( ( ))) ( ( - ( )))
3. :

, ( ( - ( ))) ( ( )).
4. :

5. :

, , ,
.

134

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


: 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 .
(

(
(

(
(
(
( (
( (
(

))
(
(
(
(
(

(
(
)))
))
(*
(

(
(

(
(

(
(

(
(

))
()

))

135

(
)))

(
)))

)))
)

)))

)))

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


( ( () ))
)))
( ( ( ( () )))
( ( ( ( ( () ))) ))
( ( ( ( () ))) ))
( ( ( ( ( ( ( () ))) )))
( ( )))
( ( ( ( )))
( ( ( ( ))) )
( ( ( ( ))) ))
( ( ( ( ( ( ( ( ))) ))) ))
( ( ( ( )))
( ( ( ( ( ( ))) ))) )
( ( ( ( ( ))) )
( ( ( ( ( ( ))) )))
( ( ( ( )))
( ( ( ( ( ( ( ( ))) ))) )))
( ( ( ( ( ))) ))
( ( ( ( ( ))) )
( ( ( ))) )
( ( ( )))
( ( ( ( ( ))) ))
( ( ( ( )))
( ( ( ( ))) ))
)
( (* ( ( ( ( ))) ))
( ( ( ))
)
))
(English
Georgian Dictionary), 50000 .
, , ,
, . , : , ,
, , .
:

*-, ,
, ; ,
, .

136

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
,

(
,

).
, , _
-
.
, 6
- ,
. ,
: ,
.
(,
5 : . : , ,
, -
.
,

.
( )
. ,
.
, ,
, ,
, ,
, .

.


(, )
(, ).

.
-
,

,
,

.
,
, .


. ,
. ,
, ,
.

137

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


, ( ), 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

,
, .
.
: . ,
,
, .
,
( )
.. :

138

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)

:
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]
-
.
, ,
.
, .
,
139

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
.
, . .
,
, ,
.
, . -
.
. ,
.
,
, () ,
.
.
.
,
,
, .
- , .

, :
.
S-
:
, ,
. ,
;

, .
,

, .
, :

nil
nil- - \ -.
(cons 'a nil).
(b a)

.
140

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


(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 is
a programmable programming language). LISP-
[11]. ,
,

.
, LISP-
.. . LISP-
. ,
, . ,
,

,
141

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
.
,
. ,
/ .

, ,
.
, 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 b
c ).
maplist
. , (maplist 'list
'(a b
c)) '(((a b c))((b c))((c))). mapcon
maplist- ,

142

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


ncons. , (mapcon 'list '(a b c)) '((a b
c)(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-,

, . ,
.
143

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


,
map-
"" . ,
map- ,
, (
), , . map
.

. ,
, LISP- .
,
, ,
.
. ,
, , .
(, ,
). ,
, , .
, ,
, .
,
.
,

LISP-,

, .
.
map- ,

(,

).

map-

.


.
.
, .

.
.
_ , .
LISP (Lisp is a programmable
programming language), ,
144

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


. ,
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 )
145

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


;
;
(DEFUN DEFCL (NCL SCL FCL ))
; , /
(SETQ ALLCL (CONS NCL ALLCL))
(SET NCL (APPEND FCL SCL)) )
; ,
(DEFUN EV-CL (VARGS) (COND
;
;
(VARGS (CONS (COND
((MEMBER (CAAR VARGS) ALLCL) (CAAR VARGS)) )
(EV-CL (CDR VARGS)))) ))
; NIL ,
(DEFUN M-ASSOC (PM MELI) (COND (MELI
(COND ((EQUAL (CAAR MELI) PM)(CDAR MELI))
(T(M-ASSOC PM (CDR MELI)))))))
; ,
;
(DEFUN METHOD (MN ARGS &OPTIONAL C)
(APPLY (M-ASSOC (CONS MN (EV-CL ARGS)) ML)
ARGS C))
; , ,
;
(DEFUN INSTANCE (CLASS &OPTIONAL CP) (COND
; LET -
(CLASS (COND ((ATOM (CAR CLASS))(INSTANCE
(CDR CLASS) CP))
((ASSOC (CAAR CLASS) CP) (INSTANCE
(CDR CLASS) CP))
(T(INSTANCE (CDR CLASS) (CONS (CAR CLASS)
CP)))
)) ) CP)
(DEFUN SLOT (OBJ FLD) (ASSOC FLD OBJ))
;
Lisp- .
:
(defclass ob () (f1 f2 ...))

146

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)


, - 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 - ( );
g f (
);
o - , f ;

147

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)

o - , g
..
,
. Objective
CAML- .
, .

.
- P .


.
, ,
. ,
. ,
, C Fortran, ,
-
, , C++-
.
, , Objective CAML
. (,
) ,
.
, ,
. ,
: , ,
-. ,
. ,
.
,
,

.
,
,

.

148

Georgian Electronic Scientific Journal: Computer Science and Telecommunications 2009|No.2(19)

1. . :
http://ru.wikipedia.org/wiki/%D0%9F%D0%B0%D1%80%D0%B0%D0%B4%D0%B8%
D0%B3%D0%BC%D0%B0_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%
D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%
D1%8F
2. http://www.literateprogramming.com/
3. .. . .
: , 1983.
4. ., . ., .1,2, : , 1990.
5. ., .
. , ,1978.
6. . , . . LISP. . , 143 .,
, 2008 .
7. .
.

.
http://www.osp.ru/os/2002/05/181454/_p1.html
8. Objective Caml-is :
http://caml.inria.fr/pub/docs/oreilly-book/html/index.html
9. . , . , . .
. , 7-9, 2008, .18-24.
10. . . 1.
11. Archvadze N., Pkhovelishvili M. The issue of universal programming. Science and
Technologies. 7-9, 2003, 49-52.
12. W.A.Woods and J.G. Schmolze. The KL-ONE Family. In: Semantic Networks in
Artificial Intelligence. Ed: Fritz Lehmann, Special Issue of International Journal
Computers & Mathematics with Applications. V. 23, N 2-5, January- March, 1992. Part
1.,p.133-178.
13. .. . //
. . . 13. .: , 1978. . 120-158.
14. -.

-
.
http://ru.wikipedia.org/wiki/%D0%9B%D0%B8%D1%81%D0%BF%D0%BC%D0%B0%D1%88%D0%B8%D0%BD%D0%B0
15. . http://www.intuit.ru. :
,
.

_______________________________
: 2009-04-26

149

You might also like