INTERNET
 :
  |    

/

, . /

,

 

:

:

:

:

: .10

: . .

: -1-93

: ..

1996

.........................................................................................................3

.......................................................................................................4

1. ..........................................................5

2. .................................................................5

3. ................................................6

4. ...............................................10

5. ..........................................................12

6. micro-LISP..................................................20

7.

micro-LISP, ................................21

8. ...............................................................................23

9. .............................23

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

........................................................................26

..................................................................................................27

..................................................................................................35

.10

" "

:

-1-93

1. :

.

2.

2.1 - : , , ,

2.2 microLISP

3. ,

3.1 ᠠ

3.2 , 堠

, :

3.2.1

3.2.2

3.2.3

3.2.4

3.2.5

3.2.6

3.2.7

3.2.8

4.

4.1

4.2

5. -

5.1 12.03.96

5.2 , ,

19.03.96

5.3 Ǡ 26.03.96

5.4 2.04.96

5.5 16.04.96

5.6 30.04.96

5.7

14.05.96

8. 21.05.96

/ ..: _____________

/ .: _____________

, , " ". (expert system, knowledge based system) - , - . .

, , , , , , , . , .

1.

(FUN.LSP) microLISP NortonEdit. , . - BD2.LSP.

-1-93 . , -1-92.

2.

, : , , , .

, , .

1. , - . "+", . , () .

1

¯

1.

+

+

+

+

2. ,

+

+

+

3. ,

+

4.

+

+

+

5.

+

6.

+

7.

+

8.

+

9.

+

10.

+

11.

+

12.

+

13.

+

14.

+

15.

+

16.

+

() .

3.

, 蠠 . ࠠ , .  蠠 , . 堠 , . , 젠 , :

1. ()

2. ()

3. ()

- . , , 蠠 .  , . " . 35- " - . " , 堠 " - . .

. "", , () , . , , . , ,  . , .

, ꠠ . - , .

, , 頠 , , . , .

򠠠 . , ࠠ , , , . , , , . ࠠ , , . "" . 󠠠 . , , . .

, . , 頠 , .

. "-", :

"-"- . , :

- : , ;

- :

;

- ( ): ;

- , .. .

:

- , , ;

- ;

- .

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

, - , , . , , . , . , , , .

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

, . , .

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

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

((1 " ")

(2 ", , ")

(3 " , ")

(4 " ")

(5 " ")

(6 " ")

(7 " ")

(8 " ")

(9 " ")

(10 " ")

(11 " ")

(12 " ")

(13 " ")

(14 " ")

(15 " ")

(16 " "))

((" " (1 2 3 4 5 6 7))

(" " (1 2 4 8 9))

(" " (1 10 11 12 13))

(" " (1 2 4 14 15 16)))

4.

.

. :

1. , , .

2. .

3. 젠 .

4. 堠 ""  ꠠ .

 . , 頠 . 񠠠 , .

堠 , . 㠠 -  .

, 젠 , , ꠠ .

.1


1.Files 2.DataBase 3.Diagnosticka 4.Quit


1. LOAD 2. SAVE 1. ADD 2. DELETE 3. REDACT 4. VIEW


堠 堠 堠 堠 堠

⠠ 頠 ⠠ 頠 ⠠

.1

5.

1. "" (loading): , , .



2. "" (saving):

, . , .


3. "" (adding): . , , , .

.





-

+

( 'end'). .

_

end

+

4. "" (viewing): , .

+

?

_

5. " " (expert): : , - , . : -YES (, , "") -NO (, , ""). , , , "" , . .


𠠠

𠠠

蠠 頠


_

-

YES

+

+

-

NO

_

,

-YES -NO

_

?

+

6. " " (logout): , , .




7. "" (deleting): . , , , . ( 'end').

, -

+

End

-

. .


8. "" (redacting): . , , .

.



. .





. 2

 3 ( ):

Start

"", ,

,

 3 ( ):   ,
 3 ( ):   "",  ,


mainmenu

 3 ( ):


menufiles menubd menucons quit

"", ,

,

 3 ( ):   "",  ,    3 ( ):  ,
 3 ( ):


 3 ( ):  log_out


loading saving adding deleting viewing redacting

, ,

, ,

 3 ( ):   3 ( ):      ,  ,    3 ( ):


plus plussym delill delsym redill redsym

 3 ( ):      3 ( ):


6. ࠠ micro-LISP

ࠠ ࠠ .2. " ", . , - .

. start mainmenu ( do, : menufiles, menubd ..). Mainmenu cond eq? .

saving with-output-to-file write ( lambda-).

( loading) with-input-from-file read ( *it_is*, *simptom*).

experting. ill, spis_num exp_ill (spis_num,ill) , . ( ), experting (.. ..).  set! *yes* *no*. experting , log_out ( ) ( cond ).

(view_ill) cond , .

(add_ill) (add_sym) append ( ), addsyms . (red_ill) (red_sym) delete! ( ), append.

(del_ill) delete!. ( delsyms ).

(del_sym) delete!, append , . {(set! *it_is* (delete! (list ill spis_nums) *it_is))} *it_is* .

7. microLISP,

, "", . WINDOW? , , . - , -, STANDARD-INPUT STANDARD-OUTPUT. - MAKE-WINDOW; WINDOW-GET-ATTRIBUTE WINDOW-SET-ATTRIBUTE!

, WINDOW-CLEAR. WINDOW-DELETE ,  . WINDOW-POPUP WINDOW-POPUP-DELETE .

WINDOW-GET-POSITION WINDOW-GET-SIZE, ; WINDOW-SET-POSITION! WINDOW-SET-SIZE!.

, WINDOW-CLEAR. WINDOW-GET-CURSOR WINDOW-SET-CURSOR!. , .

FLUSH-INPUT

FLUSH-INPUT .

򠠠 (FLUSH-INPUT {port})

port- ( ).

:

FLUSH-INPUT " " (end-of-line) , port, , . .

LAST-PAIR

.

LIST

, cdr-, . , (), . cdr- , " ". LIST , . LIST* , cdr- .

MEMBER

MEMBER, MEMQ, MEMV

, .

򠠠 (MEMBER bj list)

(MEMQ bj list)

(MEMV bj list)

obj - "-";

list -

:

obj list, EQVAL? ( MEMBER); MEMQ EQ?; MEMV - EQV? obj , , obj , . obj list, "".

DO

DO .

(DO ((var (init {step}})...)(test exp ...) stmt ...)

var - "-";

init - ⠠ "-".

init; var.

;

step... - "-".

init; var . 頠 , 蠠 init;

test - "-".  , ;

exp... - "-". 蠠 砠 ;

stmt... - "-". 蠠 test "".

8.

, , . , . .

9.

: - :  IBM PC AT XT; - - 512 b; - ࠠ ( )- 100 Kb ( ); - ; - - MS-DOS 3.0 .

:

:

fun.lsp - ( );

bd2.lsp - ( , );

 蠠 ⠠ , fun.lsp, start {ENTER}.

. , :

- / ;

- /

{ESC};

- <>.

<>:

- <>:

- {ENTER};

- <> :

- {ENTER}.

<>:

- <> :

- ( {1} {2});

- ;

- ;

- <> :

- 蠠

( {1} {2});

- ;

- <> :

-

( {1} {2});

- ;

- <> , :

- , {ESC}.

<>, :

- ( '' '' {ENTER}).

. . , .

. , , . - . ; . , , , , . .

1. ., . -: . . -, 1993.-608 .

2. ., . : . . - .: , 1990.- 320 .

3. ., . . 2- . . . - .: , 1990.

micro-LISP ( "FUN.LSP):

(define mainw(make-window "" #!true))

(define mmenuw(make-window "" #!true))

(define menufw(make-window "__" #!true))

(define menudbw(make-window "" #!true))

(define menucw(make-window "_____________________________" #!true))

(define vieww(make-window "____________" #!true))

(define addiw(make-window "____________ " #!true))

(define addsw(make-window "__________ " #!true))

(define rediw(make-window "________ " #!true))

(define redsw(make-window "_______ " #!true))

(define deliw(make-window "______________ " #!true))

(define delsw(make-window "_____________ " #!true))

(define submenuw(make-window "___ :" #!true))

(define menulw(make-window " :" #!true))

(define f)

(define *symptom*)

(define *it_is*)

(define *yes* '())

(define *no* '())

(define (start)

(window-set-position! mainw 1 1)

(window-set-size! mainw 23 78)

(window-clear mainw)

(mainmenu))

;

(define (mainmenu)

(define ch)

(Window-Set-Position! mmenuw 3 15)

(Window-Set-Size! mmenuw 1 47)

(Window-Clear mmenuw)

(display " 1.Files 2.DataBase 3.Diagnosticka 4.Quit" mmenuw)

(do ((i 0 (+ i 0)))

((> i 5)i)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(cond

((eq? ch #\1) (menufiles))

((eq? ch #\2) (menudb))

((eq? ch #\3) (menucons))

((eq? ch #\4) (exit))

)))

;

(define (menufiles)

(define ch)

(Window-Set-Position! menufw 5 16)

(Window-Set-Size! menufw 4 8)

(Window-Clear menufw)

(Window-Set-Cursor! menufw 1 1)

(display "1.LOAD" menufw)

(Window-Set-Cursor! menufw 2 1)

(display "2.SAVE" menufw)

(do ((i 0 (+ i 0)))

((> i 5)i)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(cond

((eq? ch #\1) (loading))

((eq? ch #\2) (saving))

((eq? ch #\ESCAPE)

(Window-Delete menufw)

(mainmenu))

)))

;

(define (menudb)

(define ch)

(Window-Set-Position! menudbw 5 26)

(Window-Set-Size! menudbw 6 10)

(Window-Clear menudbw)

(Window-Set-Cursor! menudbw 1 1)

(display "1.ADD " menudbw)

(Window-Set-Cursor! menudbw 2 1)

(display "2.DELETE" menudbw)

(Window-Set-Cursor! menudbw 3 1)

(display "3.REDACT" menudbw)

(Window-Set-Cursor! menudbw 4 1)

(display "4.VIEW" menudbw)

(do ((i 0 (+ i 0)))

((> i 5)i)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(cond

((eq? ch #\1)

(adding) (menudb))

((eq? ch #\2)

(deleting) (menudb))

((eq? ch #\3)

(redacting) (menudb))

((eq? ch #\4)

(viewing) (menudb))

((eq? ch #\ESCAPE)

(Window-Delete menudbw) (mainmenu))

)))

;

(define (loading)

(Window-Set-Position! menulw 20 20)

(Window-Set-Size! menulw 1 40)

(Window-Clear menulw)

(Window-Set-Cursor! menulw 1 3)

(set! f (read-line menulw))

(Window-Delete menulw)

(with-input-from-file f

(lambda ()

(set! *symptom* (read))

(set! *it_is* (read))

(flush-input)

)))

;

(define (saving)

(Window-Set-Position! menulw 20 20)

(Window-Set-Size! menulw 1 40)

(Window-Clear menulw)

(Window-Set-Cursor! menulw 2 3)

(set! f (read-line menulw))

(Window-Delete menulw)

(with-output-to-file f

(lambda ()

(write *symptom*)

(write *it_is*)

)))

;

(define (menucons)

(Window-Set-Position! menucw 6 10)

(Window-Set-Size! menucw 17 57)

(Window-Clear menucw)

(experting *it_is*)

(window-delete menucw) )

(define (experting spis_ill)

(cond ((null? spis_ill) (board)

(display " " menucw)

(wait menucw)

(set! *yes* '())

(set! *no* '()))

((exp_ill (cadar spis_ill) (caar spis_ill)))

(t (experting (cdr spis_ill))) ))

(define (exp_ill spis_num ill)

(define nums)

(define s)

(cond ((null? spis_num) (window-clear menucw) (window-set-cursor! menucw 1 1)

(display " " menucw) (display ill menucw)

(display "." menucw)

(set! nums (find_sym ill *it_is*))

(set! *yes* '())

(set! *no* '())

(log_out nums))

(t (set! s (find_sym (car spis_num) *symptom*))

(yesno? s spis_num ill)) ))

(define (into y a)

(cond ((eq? a ') (set! *yes* (append *yes* (list y))))

(t (set! *no* (append *no* (list y)))) ))

(define (yesno? y spis_num ill)

(define ans)

(cond ((member y *no*) nil)

((member y *yes*) (exp_ill (cdr spis_num) ill))

(t (and (board) (display " : " menucw)

(display y menucw)

(display " [/] ? " menucw)

(set! ans (read menucw))

(into y ans) (eq? ' ans)

(exp_ill (cdr spis_num) ill))) ))

(define (log_out nums)

(cond ((null? nums) (wait menucw))

(t (newline menucw) (display " " menucw)

(display (find_sym (car nums) *symptom*) menucw)

(log_out (cdr nums))) ))

(define (board)

(define gr)

(set! gr (window-get-cursor menucw))

(if (< (car gr) 18) (newline menucw)

(begin (window-clear menucw)

(window-set-cursor! menucw 1 1))))

(define (find_sym n spis_sym)

(if (equal? (caar spis_sym) n) (cadar spis_sym)

(find_sym n (cdr spis_sym)) ))

(define (wait wname)

(cond ((eq? (read-char wname) #\ESCAPE) t)

(t (wait wname)) ))

;

(define (viewing)

(Window-Set-Position! vieww 11 15)

(Window-Set-Size! vieww 12 47)

(Window-Clear vieww)

(view_ill *it_is*)

(window-delete vieww) )

(define (view_ill spis_ill)

(cond ((null? spis_ill) t)

(t (window-set-cursor! vieww 1 2) (display ": " vieww)

(display (caar spis_ill) vieww)

(view_sym (cadar spis_ill))

(view_ill (cdr spis_ill))) ))

(define (view_sym spis_num)

(cond ((null? spis_num) (wait vieww) (window-clear vieww))

(t (newline vieww)

(display " " vieww)

(display (find_sym (car spis_num) *symptom*) vieww)

(view_sym (cdr spis_num))) ))

;

(define (submenu)

(Window-Set-Position! submenuw 11 25)

(Window-Set-Size! submenuw 4 14)

(Window-Clear submenuw)

(window-set-cursor! submenuw 1 1)

(display "1." submenuw)

(window-set-cursor! submenuw 2 1)

(display "2." submenuw) )

;

(define (adding)

(define ch)

(submenu)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(window-delete submenuw)

(cond ((eq? ch #\1) (Window-Set-Position! addiw 6 10)

(Window-Set-Size! addiw 17 57)

(Window-Clear addiw) (add_ill)

(window-delete addiw))

((eq? ch #\2) (Window-Set-Position! addsw 6 10)

(Window-Set-Size! addsw 17 57)

(Window-Clear addsw) (add_sym)

(window-delete addsw))

((eq? ch #\ESCAPE))

(t (adding)) ))

(define ill)

(define sym)

;

(define (add_ill)

(define n)

(window-set-cursor! addiw 1 1)

(display " : " addiw)

(set! ill (read-line addiw))

(display " : end" addiw)

(newline addiw)

(set! n (caar (last-pair *symptom*)))

(set! *it_is* (append *it_is* (list (list ill

(addsyms (+ n 1) '() '() addiw)))

)) )

;

(define (add_sym)

(define n)

(define nums)

(window-set-cursor! addsw 1 2)

(display ": " addsw)

(set! ill (read-line addsw))

(display " : end" addsw)

(newline addsw)

(set! n (caar (last-pair *symptom*)))

(set! nums (find_sym ill *it_is*))

(set! *it_is* (delete! (list ill nums) *it_is*))

(set! *it_is* (append *it_is* (list (list ill

(addsyms (+ n 1) '() nums addsw)))

)) )

(define (addsyms nn spis_num nums nwin)

(display " : " nwin)

(set! sym (read-line nwin))

(if (equal? sym "end") (append nums spis_num)

(begin (set! *symptom* (append *symptom* (list (list nn sym))))

(addsyms (+ nn 1) (append spis_num (list nn)) nums nwin)) ))

;

(define (redacting)

(define ch)

(submenu)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(window-delete submenuw)

(cond ((eq? ch #\1) (Window-Set-Position! rediw 11 10)

(Window-Set-Size! rediw 6 57)

(Window-Clear rediw) (red_ill)

(window-delete rediw))

((eq? ch #\2) (Window-Set-Position! redsw 11 10)

(Window-Set-Size! redsw 8 57)

(Window-Clear redsw) (red_sym)

(window-delete redsw))

((eq? ch #\ESCAPE))

(t (redacing)) ))

;

(define (red_ill)

(define nums)

(define ill1)

(window-set-cursor! rediw 1 1)

(display " , " rediw)

(newline rediw)

(display " : " rediw)

(set! ill (read-line rediw))

(newline rediw)

(display " : " rediw)

(set! ill1 (read-line rediw))

(set! nums (find_sym ill *it_is*))

(set! *it_is* (delete! (list ill nums) *it_is*))

(set! *it_is* (append *it_is* (list (list ill1 nums)) )) )

;

(define (red_sym)

(define n1)

(define nums)

(define sym1)

(window-set-cursor! redsw 1 1)

(display " , " redsw)

(newline redsw)

(display " : " redsw)

(set! ill (read-line redsw))

(newline redsw)

(display " , " redsw)

(newline redsw)

(display " : " redsw)

(set! sym (read-line redsw))

(display " : " redsw)

(set! sym1 (read-line redsw))

(set! nums (find_sym ill *it_is*))

(set! n1 (sub sym *symptom* nums))

(set! *symptom* (delete! (list n1 sym) *symptom*))

(set! *symptom* (append *symptom* (list (list n1 sym1)) )) )

(define (sub x spis spis_x)

(let ((n (find_index x spis)))

(cond ((memb? n spis_x) n)

(t (sub x (cdr spis) spis_x)) )))

(define (find_index x spis)

(cond ((equal? (cadar spis) x) (caar spis))

(t (find_index x (cdr spis))) ))

(define (memb? a l)

(cond ((null? l) nil)

((equal? a (car l)) t)

(t (memb? a (cdr l))) ))

;

(define (deleting)

(define ch)

(submenu)

(Window-Set-Cursor! mainw 22 30)

(display " :" mainw)

(set! ch (read-char mainw))

(Window-Set-Cursor! mainw 22 30)

(display " " mainw)

(window-delete submenuw)

(cond ((eq? ch #\1) (Window-Set-Position! deliw 11 10)

(Window-Set-Size! deliw 4 57)

(Window-Clear deliw) (del_ill)

(window-delete deliw))

((eq? ch #\2) (Window-Set-Position! delsw 6 10)

(Window-Set-Size! delsw 17 57)

(Window-Clear delsw) (del_sym)

(window-delete delsw))

((eq? ch #\ESCAPE))

(t (deleting)) ))

;

(define (del_ill)

(define nums)

(window-set-cursor! deliw 1 2)

(display " , " deliw)

(newline deliw)

(display " : " deliw)

(set! ill (read-line deliw))

(set! nums (find_sym ill *it_is*))

(set! *it_is* (delete! (list ill nums) *it_is*))

(delsyms nums) )

(define (delsyms spis_nums)

(cond ((null? spis_nums) t)

(t (set! *symptom* (delete!

(list (car spis_nums)

(find_sym (car spis_nums) *symptom*))

*symptom*))

(delsyms (cdr spis_nums))) ))

;

(define (del_sym)

(define nums)

(window-set-cursor! delsw 1 2)

(display " , " delsw)

(newline delsw)

(display " : " delsw)

(set! ill (read-line delsw))

(display " : end" delsw)

(newline delsw)

(set! nums (find_sym ill *it_is*))

(subdel nums ill) )

(define n0)

(define (subdel spis_nums ill)

(display " : " delsw)

(set! sym (read-line delsw))

(if (equal? sym "end") t

(begin (set! n0 (sub sym *symptom* spis_nums))

(set! *symptom* (delete! (list n0 sym) *symptom*))

(set! *it_is* (delete! (list ill spis_nums) *it_is*))

(set! *it_is* (append *it_is* (list (list ill

(del n0 spis_nums))) ))

(subdel (del n0 spis_nums) ill)) ))

(define (del x l)

(cond ((null? l) nil)

((equal? x (car l)) (cdr l))

(t (cons (car l) (del x (cdr l)))) ))

"BD2.LSP":

((1 " ")

(2 ", , ")

(3 " , ")

(4 " ")

(5 " ")

(6 " ")

(7 " ")

(8 " ")

(9 " ")

(10 " ")

(11 " ")

(12 " ")

(13 " ")

(14 " ")

(15 " ")

(16 " "))

((" " (1 2 3 4 5 6 7))

(" " (1 2 4 8 9))

(" " (1 10 11 12 13))

(" " (1 2 4 14 15 16)))


Copyright © 2005—2007 «RefStore.Ru»