. , , ,

,,,

- — ,

........................................................................................................... 2

1 ....................................................................................... 4

2 ................... 7

2.1 ............................. 7

2.2 .................................................. 7

3 - ......................... 10

4 ............................................... 13

5 ............................................................... 19

.................................................................................................... 23

.................................... 24


. : , CASE- , .

. (). , , . .

. , , , , , , , .

, - , . , , , : - , , ..

, , .

: , , , , .

, .

: , , () .

.


1

, : , , .

1.

( 1) ( 2):

1. 蠠

5700
8200
16100
7650
12000
8200
6540

2.

:

1. :

3.

12000
8200
6540
5700
8200
16100
7650

2.

( 1) 8200.

:

, , 8200:

4.

8200
8200

3.

( 1) 13000.

:

, 12000 13000. :

5.

13000
8200
6540
5700
8200
16100
7650

4.

( 1) .

:

, , .

6.

6540
5700
8200
16100
7650

2

2.1

, , .

. . .

, , .

, . , , .

2.2

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

, ( , ..) , .

. , . , . , . , .

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

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


3 -

- 1, 2, 3, 4, 5.

:

POS ;

LST ;

AT ;

FM ;

PAYM .

1 - INSERT

2 - DELETE

3 - GET_PEOPLE_PAYMANT

4 - CHANGE_DATA

5 - GET_PEOPLE


4

;

(SETF EMPLOYEE 0)

(SETQ INPUT_STREAM (OPEN " D:\\EMPLOYEE.TXT" :DIRECTION :INPUT))

(SETQ EMPLOYEE (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

; : , , ,

;

(DEFUN INSERT (POS LST AT)

(COND

((NULL LST) (CONS AT NIL))

((EQL POS 0) (CONS AT LST))

(T (CONS (CAR LST) (INSERT (- POS 1) (CDR LST) AT)))

)

)

; AT POS LST

;

(DEFUN DELETE (FM LST)

(COND

((NULL LST) NIL)

((EQL FM (CAR (CAR LST))) (CDR LST))

(T (CONS (CAR LST) (DELETE FM (CDR LST))))

)

)

;

;

(DEFUN GET_PEOPLE_PAYMANT (FM LST)

(COND

((NULL LST) NIL)

((EQUAL FM (CAR (CAR LST))) (CADR (CAR LST)))

(T (GET_PEOPLE_PAYMANT FM (CDR LST)))

)

)

; PAYM

(DEFUN GET_PEOPLE (PAYM LST OUTPUT_STREAM)

(COND

((NULL LST) NIL)

((EQUAL PAYM (CADR (CAR LST)))

(PROGN

(PRINT (CAR (CAR LST)) OUTPUT_STREAM)

(GET_PEOPLE PAYM (CDR LST) OUTPUT_STREAM)

)

)

(T (GET_PEOPLE PAYM (CDR LST) OUTPUT_STREAM))

)

)

;

;

;

(DEFUN CHANGE_DATA (FM PAYM LST)

(COND

((NULL LST) NIL)

((EQUAL FM (CAR (CAR LST))) (SETF (CADR (CAR LST)) PAYM))

(T (CHANGE_DATA FM PAYM (CDR LST)))

)

)

;----------------------------------------------------------------------

;

;

(SETF NEW_EMPLOYEE 0)

(SETQ INPUT_STREAM (OPEN " D:\\ADD EMPLOYEE.TXT" :DIRECTION :INPUT))

(SETQ NEW_EMPLOYEE (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

;

(DO

((I 0))

((>= I (LENGTH NEW_EMPLOYEE)) EMPLOYEE)

(SETQ EMPLOYEE (INSERT 0 EMPLOYEE (NTH I NEW_EMPLOYEE)))

(SETQ I (+ I 1))

)

;

(SETQ OUTPUT_STREAM (OPEN " D:\ADD_RESULT.TXT" :DIRECTION :OUTPUT))

(PRINT EMPLOYEE OUTPUT_STREAM)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)

;----------------------------------------------------------------------

;

(SETF FM 0)

(SETQ INPUT_STREAM (OPEN " D:\\DEL_EMPLOYEE.TXT" :DIRECTION :INPUT))

(SETQ FM (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

;

(DO

((I 0))

((>= I (LENGTH NUM)) EMPLOYEE)

(SETQ EMPLOYEE (DELETE (NTH I FM) EMPLOYEE ))

(SETQ I (+ I 1))

)

;

(SETQ OUTPUT_STREAM (OPEN " D:\DEL_RESULT.TXT" :DIRECTION :OUTPUT))

(PRINT EMPLOYEE OUTPUT_STREAM)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)

;----------------------------------------------------------------------

;

(SETF FM 0)

(SETQ INPUT_STREAM (OPEN " D:\\FM.TXT" :DIRECTION :INPUT))

(SETQ FM (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

(SETQ RES NIL)

;

(DO

((I 0))

((>= I (LENGTH FM)) EMPLOYEE)

(SETQ RES (INSERT I RES (GET_PEOPLE_PAYMANT (NTH I FM) EMPLOYEE) ))

(SETQ I (+ I 1))

)

;

(SETQ OUTPUT_STREAM (OPEN " D:\PAYMANT.TXT" :DIRECTION :OUTPUT))

(PRINT RES OUTPUT_STREAM)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)

;----------------------------------------------------------------------

; PAYM

(SETF PAYM 0)

(SETQ INPUT_STREAM (OPEN " D:\\PAYM.TXT" :DIRECTION :INPUT))

(SETQ PAYM (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

;

(SETQ OUTPUT_STREAM (OPEN " D:\\PEOPLE.TXT" :DIRECTION :OUTPUT))

;

(GET_PEOPLE PAYM EMPLOYEE OUTPUT_STREAM)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)

;----------------------------------------------------------------------

;

;

;

(SETF FM 0)

(SETQ INPUT_STREAM (OPEN " D:\\CHANGE.TXT" :DIRECTION :INPUT))

(SETQ FM (READ INPUT_STREAM))

(CLOSE INPUT_STREAM)

(CHANGE_DATA (CAR FM) (CADR FM) EMPLOYEE)

;

(SETQ OUTPUT_STREAM (OPEN " D:\\NEW_EMPLOYEE.TXT" :DIRECTION :OUTPUT))

(PRINT EMPLOYEE OUTPUT_STREAM)

(TERPRI OUTPUT_STREAM)

(CLOSE OUTPUT_STREAM)

;----------------------------------------------------------------------


5

1.

6 -

7 - ,

8 -

2.

9 -

10 - ,

11

3.

12 -

13 ,

14

4.

15 -

16

17


5.

18 -

19 -

20 -


. - .

: , , . .


1.         [ ] : http://ru.wikipedia.org/wiki/_

2.         , .. [] / .. , .. . .: , 2007. 708 .

3.         , .. [] / .. .: , 2006. .1328.

4.         . . , . . [ ] / . , . .: , 2003. . 1436.

5.         , .. [] / .. , .. , .. . : , 2002. 160 .

6.         ., .. Lisp. [ ] / .., ... .: , 2003. . 79.

7.         , .. . [] / .. , .. , .. . .: , 2004. .736.

8.         . [] / . , . . .: , 1990. 460 .

........................................................................................................... 2 1 ....................................................................................... 4

 

 

 

! , , , .
. , :