Разработка оболочки экспертной системы

?ac?aaioea o?aaiaioia iaiei?ee yenia?oiie nenoaiu
Aaaaaiea
Naaiaiy anai, eoi ?aaioaao a iaeanoe eioi?iaoeee eee eioa?anoaony yoie iiaie iaeanou? iaoee, ecaanoai
oa?iei "yenia?oiua nenoaiu". Yenia?oiay nenoaia (expert system, knowledge based system) - yoi
i?ia?aiiiay nenoaia, ciaiey e oiaiey eioi?ie n?aaieiu n oiaieai e ciaieyie niaoeaeenoia a eaeie-ieaoau
niaoeaeuiie iaeanoe ciaiee. Yenia?oiua nenoaiu aianoa n nenoaiaie ia?aaioee anoanoaaiiuo ycueia
yaey?ony iaeaieaa aa?iuie a eiiia??aneii ieaia iaeanoyie eniieuciaaiey eneonnoaaiiiai eioaeeaeoa.
A ?aieao enneaaiaaiey eneonnoaaiiiai eioaeeaeoa nicaaiu iiiai?eneaiiua yenia?oiua nenoaiu aey ?aciuo
iaeanoae ciaiey, oaeeo, iai?eia?, eae iaaeoeineay aeaaiinoeea e ianeaaiaaiea iaoeaioia, aaiiua e
iieaeoey?iua enneaaiaaiey, ninoaaeaiea eiioeao?aoee au?eneeoaeuiuo iaoei, ia?aciaaiea, iiene
iaeni?aaiinoae a ono?ienoaao e nenoaiao e iiiaea a?oaea i?aeoe?aneea i?eei?aiey. A yoie ?aaioa
?ac?aaaouaaaony yenia?oiay nenoaia, naycaiiay n aeaaiinoeeie caaieaaaiee.
2. Aiaeec i?aaiaoiie iaeanoe
A aaiiie eo?niaii i?iaeoa i?aaiaoio? iaeanou ninoaaey?o caaieaaaiey ai?oaie, a eiaiii: ea?eiaeo ino?ue,
ea?eiaeo o?iie?aneee eaoa?aeuiue, ea?eiaeo o?iie?aneee aeia?o?ioe?aneee, ea?eiaeo o?iie?aneee
ao?ioe?aneee.
O ea?aie aieacie eiaaony iaai? i?eciaeia eee, au?a?aynu iaaeoeineeie oa?ieiaie, neiioiiia.
Aey oaianoaa aini?eyoey aiaeec i?aaiaoiie iaeanoe naaaai a oaaeeoo 1. A iae a noieaou iaicia?aiu
iacaaieyie aieaciae, a no?iee - iacaaieyie neiioiiia. Ia ia?ana?aiee niioaaonoao?ueo noieaoia e no?ie
noieo ciae "+", anee neiioii aaenoaeoaeuii i?eiaaea?eo enneaaoaiie aieacie. Iaie e oa ?a neiioiiu iiaoo
yaeyouny i?eciaeaie iaiie e oie ?a aieacie, iiyoiio iaeioi?ua ec ieo (neiioiiia) ia?ae?uaa?ony.
oaaeeoa1
neiioii ?
aieaciu?
ea?eiaeo
ino?ue
ea?eiaeo
o?iie?aneee
eaoa?aeuiue
ea?eiaeo
o?iie?aneee
aeia?o?ioe?aneee
ea?eiaeo
o?iie?aneee
ao?ioe?aneee
1. iauaa iaaiiiaaiea
+
+
+
+
2. nooinou ia?oaiea, naaiaiea
+
+
+
3. eaoaeu nia?aea nooie, caoai n
iie?ioie
+
4. aiein o?eieue eee aaccao?iue
+
+
+
5. eiiaaa aieu i?e aeioaiee
+
6. aieiaiay aieu
+
7. iiauoaiea oaiia?aoo?u oaea
+
8. auno?ay ooiieyaiinou aieina
+
9. ia?eiae?aneee eaoaeu n iie?ioie
+
10. io?eieinou n aoiieae
+
11. iuouaiea iaeiaeinoe
+
12. ??aiea a ai?ea
+
13. eaoaeu i?e iaino?aiee
+
14. nooie eaoaeu
+
15. neecenoay iie?uoa aonoie
neecu?
+
16. ioeaoeeaaiea n i?i?eeeaie
e?iae
+
Neaao?uei yoaiii i?iaeoe?iaaiey aoaao yaeyouny ?ac?aaioea (auai?) niiniaa i?aanoaaeaiey yoeo ciaiee.
3. Auai? niiniaa i?aanoaaeaiey ciaiee
?oiau i?iaiaeou ynia?oeco, eiiiu?oa?iay i?ia?aiia aie?ia auou niiniaia ?aoaou caaa?e iin?aanoaii
eiae?aneiai auaiaa e iieo?aou i?e yoii ainoaoi?ii iaaa?iua ?acoeuoaou. I?ia?aiia aie?ia eiaou ainooi e
nenoaia oaeoia, iacuaaaiie aacie ciaiee. I?ia?aiia oae?a aie?ia ai a?aiy eiinoeuoaoee auaiaeou
caee??aiey ec eioi?iaoee, eia?uaeny a aaca ciaiee. Iaeioi?ua yenia?oiua nenoaiu iiaoo oae?a
eniieuciaaou iiao? eioi?iaoe?, aiaaaeyaio? ai a?aiy eiinoeuoaoee. Yenia?oio? nenoaio, oaeei ia?acii,
ii?ii i?aanoaaeyou ninoiyuae ec o?ao ?anoae:
1. Aaca ciaiee (AC)
2. Iaoaieci auaiaa (IA)
3. Nenoaia iieuciaaoaeuneiai eioa?oaena (NIE)
Aaca ciaiee - oaio?aeuiay ?anou yenia?oiie nenoaiu. Iia niaa??eo i?aaeea, iienuaa?uea ioiioaiey eee
yaeaiey, iaoiau e ciaiey aey ?aoaiey caaa? ec iaeanoe i?eiaiaiey nenoaiu. Ii?ii i?aanoaaeyou aaco ciaiee
ninoiyuae ec oaeoe?aneeo ciaiee e ciaiee, eioi?ua eniieuco?ony aey auaiaa a?oaeo ciaiee.
Ooaa??aaiea "A?ii O. Eaiiaae aue 35-i i?aceaaioii Niaaeiaiiuo Ooaoia" - i?eia? oaeoe?aneiai ciaiey.
"Anee o aan aieeo aieiaa, oi i?eieoa aaa oaaeaoee oeo?aiiia" - i?eia? ciaiey aey auaiaa. Naia aaca
ciaiee iau?ii ?aniieaaaaony ia aenea eee a?oaii iineoaea.
Iaoaieci auaiaa niaa??eo i?eioeiu e i?aaeea ?aaiou. Iaoaieci auaiaa "ciaao", eae eniieuciaaou aaco
ciaiee oae, ?oiau ii?ii auei iieo?aou ?acoiii niaeano?ueany caee??aiey (auaiau) ec eioi?iaoee,
iaoiayuaeny a iae. Eiaaa yenia?oiie nenoaia caaaaony aii?in, iaoaieci auaiaa auae?aao niinia i?eiaiaiey
i?aaee aacu ciaiee aey ?aoaiey caaa?e, iinoaaeaiiie a aii?ina. Oaeoe?anee, iaoaieci auaiaa caioneaao
yenia?oio? nenoaio a ?aaioo, ii?aaaeyy eaeea i?aaeea io?ii aucaaou e i?aaiecoy e iei ainooi a aaco
ciaiee. Iaoaieci auaiaa auiieiyao i?aaeea, ii?aaaeyao eiaaa iaeaaii i?eaieaiia ?aoaiea e ia?aaaao
?acoeuoaou i?ia?aiia eioa?oaena n iieuciaaoaeai.
Eiaaa aii?in aie?ai auou i?aaaa?eoaeuii ia?aaioai, oi ainooi e aaca ciaiee inouanoaeyaony ?a?ac
eioa?oaen n iieuciaaoaeai. Eioa?oaen - yoi ?anou yenia?oiie nenoaiu, eioi?ay acaeiiaaenoaoao n
iieuciaaoaeai.
Eae i?aaeei, iieuciaaoaee iaei cia?o ia i?aaiecaoee aacu ciaiee, iiyoiio eioa?oaen ii?ao iiii?u ei ?aaioaou
n yenia?oiie nenoaiie aa?a, anee iie ia cia?o, eae iia i?aaieciaaia. Eioa?oaen ii?ao oae?a iauynieou
iieuciaaoae? , eaeei ia?acii yenia?oiay nenoaia auaiaeo ?acoeuoao.
Nenoaia eioa?oaena n iieuciaaoaeai i?eieiaao eioi?iaoe? io iieuciaaoaey e ia?aaaao aio eioi?iaoe?.
I?inoi aiai?y, nenoaia eioa?oaena aie?ia oaaaeouny, ?oi, iinea oiai eae iieuciaaoaeu iienae caaa?o, any
iaiaoiaeiay eioi?iaoey iieo?aia. Eioa?oaen, iniiauaaynu ia aeaa e i?e?iaa eioi?iaoee, aaaaaiiie
iieuciaaoaeai, ia?aaaao iaiaoiaeio? eioi?iaoe? iaoaiecio auaiaa. Eiaaa iaoaieci auaiaa aica?auaao ciaiey,
auaaaaiiua ec aacu ciaiee, eioa?oaen ia?aaaao eo ia?aoii iieuciaaoae? a oaiaiie oi?ia. Eioa?oaen n
iieuciaaoaeai e iaoaieci auaiaa iiaoo ?anniao?eaaouny eae "i?eei?aiea" e aaca ciaiee. Iie aianoa
ninoaaey?o iaiei?eo yenia?oiie nenoaiu. Aey aacu ciaiee, eioi?ay niaa??eo iaoe?io? e ?aciiia?acio?
eioi?iaoe?, iiaoo auou ?ac?aaioaiu e ?aaeeciaaiu ianeieuei ?aciuo iaiei?ae. Oi?ioi ?ac?aaioaiiua iaiei?ee
yenia?oiuo nenoai iau?ii niaa??ao iaoaieci aey aiaaaeaiey e iaiiaeaiey eioi?iaoee a aaca ciaiee.
Eae aeaei , yenia?oiay nenoaia ninoieo ec o?ao iniiaiuo ?anoae. Acaeiinaycu ia?ao ?anoyie ii?ao auou
nei?iie, caaenyuae io i?e?iau e i?aaiecaoee ciaiee, a oae?a io iaoiaia e oaeae auaiaa.
Aacu ciaiee e niiniau i?aanoaaeaiey
I?iaoeoeiiiay iiaaeu
Yoi iaei ec iaeaieaa ?anoi eniieucoaiuo a yenia?oiuo nenoaiao niiniaia i?aanoaaeaiey ciaiee. Iniiaiay eaay
caee??aaony a annioee?iaaiee n niioaaonoao?ueie aaenoaeyie iaai?a oneiaee a aeaa i?aaee oeia "anee-
oi", iacuaaaiuo oae?a i?iaoeoeyie:
ANEE oneiaea OI aaenoaey
"Anee-oi"-i?aaeea iau?ii ieacuaa?ony aanuia anoanoaaiiui au?aceoaeuiui n?aanoaii i?aanoaaeaiey
ciaiee. E?iia oiai, iie iaeaaa?o neaao?ueie i?eaeaeaoaeuiuie naienoaaie:
? iiaoeuiinou: ea?aia i?aaeei iienuaaao iaaieuoie, ioiineoaeuii iacaaeneiue o?aaiaio ciaiee;
? aicii?iinou eie?aiaioiiai ia?aueaaiey: aiaaaeaiea iiauo i?aaee a aaco ciaiee i?ienoiaeo ioiineoaeuii
iacaaeneii io a?oaeo i?aaee;
? oaianoai iiaeoeeaoee (eae neaanoaee iiaoeuiinoe): noa?ua i?aaeea ii?ii eciaiyou e caiaiyou ia
iiaua ioiineoaeuii iacaaeneii io a?oaeo i?aaee;
? i?eiaiaiea i?aaee niinianoaoao i?ic?a?iinoe nenoaiu, o.a. niiniaiinoe e iauyniaie? i?eiyouo
?aoaiee e iieo?aiiuo ?acoeuoaoia.
Iaiaei i?iaoeoeiiiua nenoaiu ia naiaiaiu io iaainoaoeia:
? i?ioann auaiaa iaiaa yooaeoeaai, ?ai a a?oaeo nenoaiao, iineieueo aieuoay ?anou a?aiaie i?e
auaiaa cao?a?eaaaony ia iai?iecaiaeoaeuio? i?iaa?eo i?eiaieiinoe i?aaee;
? yoio i?ioann o?oaii iiaaaaony oi?aaeaie?;
? nei?ii i?aanoaaeou ?iaiaeaiao? ea?a?oe? iiiyoee.
O?aeiu
I?aanoaaeaiea ciaiee, iniiaaiiia ia o?aeiao, yaeyaony aeuoa?iaoeaiui ii ioiioaie? e nenoaiai i?iaoeoee: iii
aaao aicii?iinou o?aieou ?iaiaeaiao? ea?a?oe? iiiyoee a aaca ciaiee a yaiie oi?ia. O?aeiii iacuaaaony
no?oeoo?a aey iienaiey noa?aioeiiie neooaoee, ninoiyuay ec oa?aeoa?enoee yoie neooaoee e eo
cia?aiee, oa?aeoa?enoeee iacuaa?ony neioaie, a cia?aiey - caiieieoaeyie neioia. Neio ii?ao niaa??aou
ia oieuei eiie?aoiia cia?aiea, ii e eiy i?ioaao?u, iicaiey?uae au?eneeou aai ii caaaiiiio aeai?eoio, a oae?a
iaio eee ianeieuei i?iaoeoee (ya?enoee), n iiiiuu? eioi?uo yoi cia?aiea ii?ii iaeoe. A neio ii?ao aoiaeou ia
iaii, a ianeieuei cia?aiee. Eiiaaa neio aee??aao eiiiiiaio, iacuaaaiue oanaoii, eioi?ue caaaao aeaiacii eee
ia?a?aiu aai aicii?iuo cia?aiee. Oanao oeacuaaao oae?a a?aie?iua cia?aiey caiieieoaey neioa.
Niaieoiiinou o?aeiia, iiaaee?o?uay eaeo?-ieaoau i?aaiaoio? iaeanou, i?aanoaaeyao niaie
ea?a?oe?aneo? no?oeoo?o, a eioi?o? o?aeiu niaaeiy?ony n iiiiuu? ?iaiaeaiauo naycae. Ia aa?oiai
o?iaia ea?a?oee iaoiaeony o?aei, niaa??auee iaeaieaa iieio? eioi?iaoe?, enoeiio? aey anao inoaeuiuo
o?aeiia. O?aeiu iaeaaa?o niiniaiinou? ianeaaiaaou cia?aiey oa?aeoa?enoee naieo ?iaeoaeae,
iaoiayueony ia aieaa aunieii o?iaia ea?a?oee. Cia?aiey oa?aeoa?enoee o?aeiia iiaoo ia?aaaaaouny ii
oiie?aie? o?aeiai, iaoiayueiny ie?a ieo a ea?a?oee, ii anee iineaaiea niaa??ao nianoaaiiua cia?aiey
aaiiuo oa?aeoa?enoee, oi a ea?anoaa enoeiiuo i?eieia?ony eiaiii iie.
Iaeaieaa y?ei ainoieinoaa o?aeiiauo nenoai i?aanoaaeaiey ciaiee i?iyaey?ony a oii neo?aa, anee
?iaiaeaiaua nayce eciaiy?ony ia?anoi e i?aaiaoiay iaeanou ian?eouaaao iaiiiai enee??aiee. Ai o?aeiiauo
nenoaiao aaiiua i ?iaiaeaiauo naycyo o?aiyony yaii, o.a. oae ?a, eae e cia?aiey anao a?oaeo oeiia.
Cia?aiey neioia i?aanoaaey?ony a nenoaia a aaeinoaaiiii yecaiiey?a, iineieueo aee??a?ony oieuei a iaei
o?aei, iienuaa?uee iaeaieaa iauaa iiiyoea ec anao oao, eioi?ua niaa??ao neio n aaiiui eiaiai. Oaeia
naienoai nenoai o?aeiia aaao aicii?iinou oiaiuoeou iauai iaiyoe, iaiaoiaeiue aey eo ?aciauaiey a
eiiiu?oa?a. Aua iaii ainoieinoai o?aeiia ninoieo a oii, ?oi cia?aiea e?aiai neioa i?e iaiaoiaeiinoe ii?ao
auou au?eneaii n iiiiuu? niioaaonoao?ueo i?ioaao? eee iaeaaii ya?enoe?aneeie iaoiaaie.
Eae iaainoaoie o?aeiiauo nenoai neaaoao ioiaoeou eo ioiineoaeuii aunieo? nei?iinou, ?oi i?iyaeyaony a
nie?aiee nei?inoe ?aaiou iaoaiecia auaiaa e a oaaee?aiee o?oaiaieinoe aianaiey eciaiaiee a ?iaiaeaiao?
ea?a?oe?. E?iia oiai, ai o?aeiiauo nenoaiao cao?oaiaia ia?aaioea enee??aiee.
Naiaioe?aneea naoe
Naiaioe?aneay naou, ii iiaie? niaoeaeenoia, - iaeaieaa iauee niinia i?aanoaaeaiey ciaiee, i?e?ai iia
iiyaeeanu, ii-aeaeiiio, ?aiaa a?oaeo. A iae iiiyoey e eeannu, a oae?a ioiioaiey e nayce ia?ao ieie
i?aanoaaeaiu a aeaa naoe. Naiaioe?aneay naou ioia?a?aao niaieoiiinou iauaeoia i?aaiaoiie iaeanoe e
ioiioaiee ia?ao ieie, i?e yoii iauaeoai niioaaonoao?o aa?oeiu (eee oceu) naoe, a ioiioaieyi - niaaeiy?uea
eo aoae. A ea?anoaa iauaeoia iiaoo aunooiaou niauoey, aaenoaey, iaiauaiiua iiiyoey eee naienoaa
iauaeoia. Naienoaa i?aanoaaey?ony a naoe oae?a a aeaa aa?oei e neo?ao aey iienaiey eeannia
iauaeoia. Aa?oeiu naoe niaaeiy?ony aoaie, anee niioaaonoao?uea iauaeou i?aaiaoiie iaeanoe iaoiayony
a eaeii-eeai ioiioaiee.
Eae e a nenoaia, iniiaaiiie ia o?aeiao, a naiaioe?aneie naoe iiaoo auou i?aanoaaeaiu ?iaiaeaiaua ioiioaiey,
eioi?ua iicaiey?o ?aaeeciaaou ianeaaiaaiea naienoa io iauaeoia-?iaeoaeae. Yoi ianoiyoaeunoai i?eaiaeo
e oiio, ?oi naiaioe?aneea naoe i?eia?aoa?o aieuoeinoai iaainoaoeia e ainoieinoa i?aanoaaeaiey ciaiee a
aeaa o?aeiia. Ii iniiaiia i?aeiouanoai naiaioe?aneeo naoaecaee??aaony a eo iaaeyaiinoe e
iaiin?aanoaaiiie naycaiiinoe iiiyoee ?a?ac naou, eioi?ay iicaieyao auno?i iaoiaeou nayce iiiyoee e ia yoie
iniiaa oi?aaeyou i?eieiaaiuie ?aoaieyie. Eiaiii yoio oi?iaeeci aue eniieuciaai a aaiiie ?aaioa a ea?anoaa
oi?iaeecia aey i?aanoaaeaiey ciaiee a AC. Iniiaiie iaainoaoie naoae - nei?iinou ia?aaioee enee??aiee.
Oaeei ia?acii, eniieucoy aaiiua iiiyoey, iaoa II ia ycuea microLISP i?aanoaaeyaony neaao?uei ia?acii:
((1 "iauaa iaaiiiaaiea")
(2 "nooinou, ia?oaiea, naaiaiea")
(3 "eaoaeu nia?aea nooie, caoai n iie?ioie")
(4 "aiein o?eieue eee aaccao?iue")
(5 "eiiaaa aieu i?e aeioaiee")
(6 "aieiaiay aieu")
(7 "iiauoaiea oaiia?aoo?u oaea")
(8 "auno?ay ooiieyaiinou aieina")
(9 "ia?eiae?aneee eaoaeu n iie?ioie")
(10 "io?eieinou n aoiieae")
(11 "iuouaiea iaeiaeinoe")
(12 "??aiea a ai?ea")
(13 "eaoaeu i?e iaino?aiee")
(14 "nooie eaoaeu")
(15 "neecenoay iie?uoa aonoie neecu? ")
(16 "ioeaoeeaaiea n i?i?eeeaie e?iae"))
(("ea?eiaeo ino?ue" (1 2 3 4 5 6 7))
("ea?eiaeo o?iie?aneee eaoa?aeuiue" (1 2 4 8 9))
("ea?eiaeo o?iie?aneee aeia?o?ioe?aneee" (1 10 11 12 13))
("ea?eiaeo o?iie?aneee ao?ioe?aneee" (1 2 4 14 15 16)))
4. ?ac?aaioea iai? yenia?oiie nenoaiu
iaania?eaa?uaai caaaiiua ?a?eiu
Aey iaania?aiey iaeaieaa iiiyoiie ?aaiou n i?ia?aiiie ?ac?aaioaia ea?a?oe?aneay no?oeoo?a iai?.
Nenoaia iieuciaaoaeuneiai eioa?oaena iaania?eaaao acaeiiaaenoaea ia?ao yenia?oiie nenoaiie e
iieuciaaoaeai. Yoi acaeiiaaenoaea iau?ii aee??aao ianeieuei ooieoee:
1. Ia?aaioea aaiiuo, iieo?aiiuo n eeaaeaoo?u, e aunaa?eaaiea aiaeiuo e auaiaeiuo aaiiuo ia ye?aia.
2. Iiaaa??ea aeaeiaa ia?ao iieuciaaoaeai e nenoaiie.
3. ?aniiciaaaiea neooaoee iaiiieiaiey ia?ao iieuciaaoaeai e nenoaiie.
4. Iaania?aiea "a?o?anoaaiiinoe" ii ioiioaie? e iieuciaaoae?.
Nenoaia eioa?oaena n iieuciaaoaeai aie?ia yooaeoeaii ia?aaaouaaou aaia e auaia. Aey yoiai iaiaoiaeii
ia?aaaouaaou aaiaeiua e auaiaeiua aaiiua auno?i, a yniie e au?aceoaeuiie oi?ia. Iaiaoiaeii oae?a
aee??eou aicii?iinou ?aaiou n aiiieieoaeuiuie n?aanoaaie oaeeie, eae iaaieoiua aenee e aiiieieoaeuiua
oaeeu aaiiuo.
E?iia oiai, nenoaia eioa?oaena aie?ia iiaaa??eaaou niioaaonoao?uee aeaeia ia?ao iieuciaaoaeai e
nenoaiie. Aeaeia - yoi iauay oi?ia eiinoeuoaoee n yenia?oiie nenoaiie.
Eiinoeuoaoey aie?ia caaa?oaouny yniui ooaa??aaieai, auaaaaaiui nenoaiie, e iauyniaieai
iineaaiaaoaeuiinoe auaiaa, i?eaaaoae e yoiio ooaa??aaie?.
6. Iienaiea i?ia?aiiu ia micro-LISP
No?oeoo?iay noaia i?ia?aiiu ia Eenia ecia?a?aia ia ?en.2. Ia iniiaiuo i?ioaao?ao iaienaii a ?acaaea
"?ac?aaioea i?ioaao? iaiei?ee", a eioi?ii i?aanoaaeaiu noaiu aeai?eoiia eo ?aaiou.
Oaia?u ia?aeaai iaiin?aanoaaiii e iienaie? i?ia?aiiu. Aeaaiay i?ioaao?a start caioneaao i?ioaao?o
mainmenu (iia i?aanoaaeaia a aeaa aaneiia?iiai oeeea do, oae?a i?aanoaaeaiu e ana iiaiai?: menufiles,
menubd e o.a.). Mainmenu ?enoao aeaaiia iai? e caanu ?a n iiiiuu? au?a?aiey cond e eq? i?aaieciaaiii
iieo?aiea auai?a e caione aua?aiiie i?ioaao?u.
I?ioaao?a saving inouanoaeyao caienu AA a oaee n iiiiuu? ano?iaiiiai au?a?aiey with-output-to-file e
ooieoee write (ana yoi i?aaieciaaiii a aeaa lambda-au?a?aiey).
Caa?ocea oaeea (i?ioaao?a loading) i?ienoiaeo n iiiiuu? ano?iaiiuo with-input-from-file e read (i?e?ai
AA aieaciae i?aanoaaeaia a aeaa nienea *it_is*, a neiioiiia a aeaa nienea *simptom*).
Iinoaiiaea aeaaiica inouanoaeyaony n iiiiuu? ooieoee experting. Ec AA auae?aaony aieaciu ill, aa?aony
nienie aa neiioiiia spis_num e n iiiiuu? ooieoee exp_ill (spis_num,ill) ii?aaaeyaony, anou ee o iieuciaaoaey
yoe neiioiiu. Anee yoa ooieoey aoaao ei?iie (ia cai?in iieuciaaoaeu ioaaoee io?eoaoaeuii), oi i?iecieaao
?aeo?neaiue aucia ooieoee experting io eiioa nienea aieaciae (o.a. a aaeuiaeoai aoaao aua?aia
neaao?uay e o.a.).A i?ioanna ?aaiou ooieoee n iiiiuu? ooieoee set! oi?ie?o?ony nienee iiei?eoaeuiuo e
io?eoaoaeuiuo ioaaoia iieuciaaoaey *yes* e *no*. Anee ooieoey experting auiieieea nai? ?aaioo e
aeaaiic iinoaaeai oniaoii, oi ooieoey log_out (iauyniaiea eiae?aneiai auaiaa) auaiaeo ia ye?ai iacaaiea
ii?aaaeaiiie aieacie e aa neiioiiu (ooieoey eniieucoao aey yoiai ooieoe? cond e ?aeo?ne?).
A ?a?eia i?iniio?a nienea aieaciae e neiioiiia (view_ill) eniieucoaony cond e ?aeo?neaiue aucia ooieoee
io oainoa nienea, ?oi iicaieyao auaanoe ana niaa??eiia AA ia ye?ai.
A ?a?eia aiaaaeaiey aieaciae (add_ill) e neiioiiia (add_sym) eniieucoaony ano?iaiiay ooieoey append
(aey niaaeiaiey nieneia), a ?aeo?neaiue aucia ooieoee addsyms iaania?eaaao aicii?iinou aiaaaeaiey e
aieacie ianeieueeo neiioiiia. I?e ?aaaeoe?iaaiee aieaciae (red_ill) e neiioiiia (red_sym) noa?ia cia?aiea
oaaeyaony n iiiiuu? ooieoee delete! (oaaeaiea yeaiaioa ec nienea), a iiaia iaaaeyaony n iiiiuu? append.
Oaaeaiea aieaciae (del_ill) inouanoaeyaony n iiiiuu? ooieoee delete!. I?e oaaeaiee aieacie
aaoiiaoe?anee oaaey?ony e ana aa neiioiiu (?aeo?neaii aucuaay naia naay io eiioa oaaeyaiiai nienea
i?eciaeia ooieoey delsyms iineaaiaaoaeuii oaaeyao ana neiioiiu yoie aieacie).
Oaaeaiea neiioiia (del_sym) oae?a inouanoaeyaony n iiiiuu? delete!, ii i?e yoii n iiiiuu? ooieoee append
oi?ie?oaony iiaue nienie neiioiiia aieacie, neiioii eioi?ie oaaeyaony. Caoai i?ienoiaeo oaaeaiea aieacie ni
noa?ui nieneii neiioiiia {(set! *it_is* (delete! (list ill spis_nums) *it_is))} e aiaaaeaiea e nieneo *it_is*
yoie ?a aieacie n iiaui nieneii.
7. E?aoeia iienaiea ano?iaiiuo i?aaeeaoia e ooieoee microLISP, eniieucoaiuo a i?ia?aiia
Ieia
Ieia yaey?ony iauaeoaie, iiaiaiuie "ii?oai", eioi?ua i?aanoaaey?o niaie i?yiioaieuiua iaeanoe ia ye?aia.
I?aaeeao WINDOW? ii?aaaeyao, aaenoaeoaeuii ee caaaiiue iauaeo yaeyaony ii?oii, i?aanoaaey?uei
ieii ia ye?aia. Ana eioa?aeoeaiua ieia aaiaa-auaiaa i?aanoaaey?ony iin?aanoaii ieii, aee??ay aaia-auaia,
iaania?eaaaiue ii?oaie STANDARD-INPUT e STANDARD-OUTPUT. Iiaua ieia-ii?ou nicaa?ony e
ioe?uaa?ony n iiiiuu? MAKE-WINDOW; eo ao?eaoou ainooiiu n iiiiuu? WINDOW-GET-
ATTRIBUTE e iiaeoeoe?o?ony WINDOW-SET-ATTRIBUTE!
Ieia ai oao ii? ia auaiayony ia ye?ai, iiea iaeanou aey ieo ia i?enoeony n iiiiuu? WINDOW-CLEAR.
WINDOW-DELETE i?euaao iaeanou ye?aia, caiyoiai ieiii. WINDOW-POPUP e WINDOW-
POPUP-DELETE auaa?o ianeieuei ia?ae?uaa?ueony ieii.
Iiceoey ieia ia ye?aia e ?acia? aai no?ie e noieaoia onoaiaaeeaa?ony WINDOW-GET-POSITION e
WINDOW-GET-SIZE, niioaaonoaaiii; iiaeoeeaoey auiieiyaony WINDOW-SET-POSITION! e
WINDOW-SET-SIZE!.
Iiaeoeeaoey iiceoee e ?acia?ia ieia ii?ao auou auiieiaia ia?aa oai, eae ieii ecia?aeuii auaiaeony ia ye?ai ii
WINDOW-CLEAR. Iiceoey eo?ni?a onoaiaaeeaaaony n iiiiuu? WINDOW-GET-CURSOR e
eciaiyaony WINDOW-SET-CURSOR!. Eo?ni? iiyaeyaony ia ye?aia oieuei oiaaa, eiaaa aaia
i?iecaiaeony n eeaaeaoo?u.
FLUSH-INPUT
I?ioaao?a FLUSH-INPUT ?enoeo aooa? aaiaiiai ii?oa.
Oi?iao (FLUSH-INPUT {port})
Ia?aiao? port- aaiaiie ii?o (iaiaycaoaeuiue a?aoiaio).
Iauyniaiea:
FLUSH-INPUT ioa?anuaaao e?aua eeoa?u e aee??aao neaao?uo? "iineaaiaaoaeuiinou eiioa no?iee"
(end-of-line) a aooa? aaiaa, eioi?ue naycai n port, anee ii caaai, eee n oaeouei aaiaiui ii?oii. Auaaaony
iaii?aaaeaiiia cia?aiea.
LAST-PAIR
Aica?auaao iineaai?? ia?o iaionoiai nienea.
LIST
Eiiiiceoee ia?, naycaiiuo ?a?ac eo cdr-eiiiiiaiou, iacuaa?ony nieneaie. Ionoie nienie, iaicia?aaiue eae (),
oae?a yaeyaony nieneii. Eiaaa oaii?ea cdr-naycae a ia?a ieai?eaaaony ionoui nieneii, oiaaa ia?a
iacuaaaony "nianoaaiiui nieneii". I?ioaao?a LIST iaania?eaaao oaeie nienie, ninoiyuee ec cia?aiee aai
a?aoiaioia. LIST* iaania?eaaao iioi?ee nienie, ii eia?uee cia?aiea aai iineaaiaai a?aoiaioa a cdr-eiiiiiaioa
iineaaiae ia?u oaii?ee.
MEMBER
MEMBER, MEMQ, MEMV
I?ioaao?a
Aaiiua i?ioaao?u auaa?o iianienie, ia?eia?ueeny n iaeioi?iai niaoeoe?aneiai iauaeoa a nianoaaiiii nienea.
Oi?iao (MEMBER ibj list)
(MEMQ ibj list)
(MEMV ibj list)
Ia?aiao?u obj - e?aie iauaeo a "EENI-IEE?I";
list - nianoaaiiue nienie
Iauyniaiea:
Aaiiua i?ioaao?u euoo ia?aia iiyaeaiea obj a list, eniieucoy EQVAL? aey n?aaiaiey (a neo?aa
MEMBER); i?e MEMQ eniieucoaony EQ?; i?e MEMV - EQV? Anee obj iaeaai, iianienie,
niaa??auee obj eae ia?aue yeaiaio, auaaaony eae ?acoeuoao. Anee obj ia iaeaai a list, auaaaony
"ei?u".
DO
Niaoeaeuiia au?a?aiea
DO iaania?eaaao iaeaieaa iauo? aicii?iinou au?eneaiey eoa?aoee.
Oi?iao
(DO ((var (init {step}})...)(test exp ...) stmt ...)
Ia?aiao?u var - e?aie eaaioeoeeaoi? "EENI-IEE?I";
init - e?aua au?a?aiey a "EENI-IEE?I".
Au?eneyaony ea?aia init; ?acoeuoao eniieucoaony eae cia?aiea niioaaonoao?uaai var.
Yoio a?aoiaio iaiaycaoaeuiue;
step... - e?aua au?a?aiey "EENI-IEE?I".
Au?eneyaony ea?aia init; ?acoeuoao eniieucoaony eae cia?aiea niioaaonoao?uaai var aey neaao?uae
eoa?aoee. Yoio iaiaycaoaeuiue a?aoiaio ii?ao auou iienai, oieuei anee iienai init;
test - e?aia au?a?aiea "EENI-IEE?I". Yoi au?a?aiea yaeyaony oneiaeai, ii eioi?iio eoa?aoey
inoaiaaeeaaaony;
exp... - e?aua au?a?aiey "EENI-IEE?I". Yoe au?a?aiey au?eney?ony ia?aa auoiaii ec oeeea;
stmt... - e?aua au?a?aiey "EENI-IEE?I". Yoe au?a?aiey au?eney?ony ii ii?yaeo ea?aue ?ac eae test
aica?auaao "ei?u".
8. Ioeaaea i?ia?aiiu
Aey oaianoaa ioeaaee i?ia?aiia ienaeanu ia any n?aco, a iinoaiaiii, ioaaeuiuie i?ioaao?aie. Ea?aay
i?ioaao?a nia?aea ioea?eaaeanu e i?iaa?yeanu, a iioii ?ac?aaaouaaeanu neaao?uay. Iinea i?iaa?ee
ea?aie i?ioaao?u a ioaaeuiinoe ioea?eaaeanu any i?ia?aiia oaeeeii e ono?aiyeenu iineaaiea iaai?aaioee
e ioeaee.
9. Eino?oeoey iieuciaaoae? e i?eia? auiieiaiey i?ia?aiiu
Iaiaoiaeiua aiia?aoiua n?aanoaa
Aey ?aaiou aaiiie i?ia?aiiu iaiaoiaeii: - eiiiu?oa? : ?aeaoaeuii IBM PC AT eee XT; - iia?aoeaiay iaiyou -
ia iaiaa 512 Eb; - ianoa ia aei?anoa?a (eee e?aii a?oaii caiiieia?uai ono?ienoaa)- ia iaiaa 100 Kb (a
caaeneiinoe io ?acia?a aacu aaiiuo); - aenieae n e?aie a?aoe?aneie ea?oie; - iia?aoeiiiay n?aaa - MS-
DOS aa?nee 3.0 e auoa.
Ninoaa iineoaeae aaiiuo:
Aey ii?iaeuiie ?aaiou i?ia?aiiu iaiaoiaeii iaee?ea neaao?ueo oaeeia:
fun.lsp - oaee caionea (oaee niaa??auee an? i?ia?aiio);
bd2.lsp - oaee aacu aaiiuo (eee e?aie a?oaie oaee, niaa??auee aaco aaiiuo iieuciaaoaey);
Aey caionea i?ia?aiiu io?ii aieoe a Eeni, caa?oceou oaee fun.lsp, iaa?aou start e ia?aou eeaaeoo
{ENTER}.
Iienaiea ?aaiou n i?ia?aiiie
Iinea caionea i?ia?aiiu Au iiiaaaaoa a aa eioaa?e?iaaiio? n?aao. Aey ?aaiou n iae io?ii ciaou, ?oi:
- aey auai?a io?iiai ioieoa iai?/iiaiai? io?ii iaa?aou iiia? yoiai ioieoa;
- aey ia?aoiaa ec ie?iaai iiaiai? a enoiaiia iai?/iiaiai? io?ii
ia?aou eeaaeoo {ESC};
- aey auoiaa ec i?ia?aiiu io?ii aua?aou ioieo aeaaiiai iai? :
- iaaa?eoa ia eeaaeaoo?a iacaaiea io?iiai aai oaeea aacu aaiiuo e ia?ieoa eeaaeoo {ENTER};
- aey ?aaiou n ioieoii :
- aey ?aaiou n ioieoii io?ii:
- aua?aou aoaaoa ee Au ?aaaeoe?iaaou iacaaiey iaeni?aaiinoae eee i?eciaeia (ia?aou niioaaonoaaiii
oeo?o {1} eee {2});
- aaanoe iacaaiea iaeni?aaiinoe eee i?eciaea aey ?aaaeoe?iaaiey;
- aaanoe iiaua eni?aaeaiiua cia?aiey;
- aey ?aaiou n ioieoii io?ii:
- aua?aou aoaaoa ee Au aiaaaeyou iacaaiey iaeni?aaiinoae eee
i?eciaeia (ia?aou niioaaonoaaiii oeo?o {1} eee {2});
- iooai aaiaa eioi?iaoee n eeaaeaoo?u aianoe iiao? caienu;
- aey ?aaiou n ioieoii io?ii:
- aua?aou aoaaoa ee Au oaaeyou iacaaiey iaeni?aaiinoae eee
i?eciaeia (ia?aou niioaaonoaaiii oeo?o {1} eee {2});
- aaanoe iacaaiea oaaeyaiie iaeni?aaiinoe eee i?eciaea;
- aey ?aaiou n ioieoii iaiaoiaeii ciaou, ?oi:
- eioi?iaoe? ia ye?aia ii?ii iaiyou, ia?eiay eeaaeoo {ESC}.
?aaioay n iiaiai? , io?ii:
- ioaa?aou ia aii?inu (iaae?aou niioaaonoaaiii 'A' eee 'I' e ia?eiaou eeaaeoo {ENTER}).
Caee??aiea
A aaiiie ?aaioa auea ?aaeeciaaia eaay nicaaiey o?aaiaioa iaiei?ee yenia?oiie nenoaiu. A ?acoeuoaoa
?ac?aaioee EI? auea iieo?aia eioaa?e?iaaiiay n?aaa ii aeaaiinoeea caaieaaaiee. E ie?nai aaiiie i?ia?aiiu
ii?ii ioianoe aiaieuii iiaa?oiinoiua ciaiey iieuciaaoaey ii ?aaioa n eiiiu?oa?ii, eioi?ua o?aao?ony aey
?aaiou n iae.
N?aae aicii?iuo ii?aeaiee ii?ii neacaou i ?ac?aaioea nenoaiu iiiiue i?e ?aaioa n i?ia?aiiie. Ii?ii oae?a
onei?ieou i?ia?aiio, ia?aienaa aa oae, ?oiau iia ?aaioaea ia iniiaa ?anno?aaiee n eniieuciaaieai
aa?iyoiinoiiai iiaoiaa. ?anoi e yenia?oiui nenoaiai i?aauyaey?o aiiieieoaeuiia o?aaiaaiea - niiniaiinou eiaou
aaei n iaii?aaaeaiiinou? e iaiieiioie. Eioi?iaoey i iinoaaeaiiie caaa?a ii?ao auou iaiieiie eee iaiaaa?iie;
ioiioaiey ia?ao iauaeoaie i?aaiaoiie iaeanoe iiaoo auou i?eaee?aiiuie. Iai?eia?, ii?ao ia auou iieiie
oaa?aiiinoe a iaee?ee o iieuciaaoaey iaeioi?iai neiioiia eee a oii, ?oi aaiiua, iieo?aiiua i?e ii?aaaeaiee,
aa?iu. Ai anao yoeo neo?ayo eae ?ac e iaiaoiaeiu ?anno?aaiey n eniieuciaaieai aa?iyoiinoiiai iiaoiaa.
I?eei?aiea A
Iieiue oaeno i?ia?aiiu ia ycuea micro-LISP (oaee "FUN.LSP):
(define mainw(make-window "AIEOI?" #!true))
(define mmenuw(make-window "IAI?" #!true))
(define menufw(make-window "__OAEEU" #!true))
(define menudbw(make-window "AacaAaiiuo" #!true))
(define menucw(make-window "_____________________________AEAAIINOEEA" #!true))
(define vieww(make-window "____________I?INIIO?" #!true))
(define addiw(make-window "____________AIAAAEAIEA AIEACIE" #!true))
(define addsw(make-window "__________AIAAAEAIEA NEIIOIIIA" #!true))
(define rediw(make-window "________?AAAEOE?IAAIEA AIEACIE" #!true))
(define redsw(make-window "_______?AAAEOE?IAAIEA NEIIOIIA" #!true))
(define deliw(make-window "______________OAAEAIEA AIEACIE" #!true))
(define delsw(make-window "_____________OAAEAIEA NEIIOIIA" #!true))
(define submenuw(make-window "___?aaioa n:" #!true))
(define menulw(make-window "Aaaaeoa EI? OAEEA :" #!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))
; Aeaaiia iai?
(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 "Aao auai? :" 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))
)))
; Iai? Oaeeia
(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 "AAO AUAI? :" 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))
)))
; Iai? AacuAaiiuo
(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 "AAO AUAI? :" 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))
)))
; Caa?ocea oaeea
(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)
)))
; Caienu oaeea
(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*)
)))
;Iai? aeaaiinoeee
(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 " IAAICII?II II?AAAEEOU AEAAIIC " 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 " O AAN " 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 '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 " NEIIOII: " menucw)
(display y menucw)
(display " [A/I] ? " menucw)
(set! ans (read menucw))
(into y ans) (eq? 'a 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)) ))
;I?iniio?
(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 "AIEACIU: " 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))) ))
;Aniiiiaaoaeuiia iiaiai?
(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.AIEACI?IE" submenuw)
(window-set-cursor! submenuw 2 1)
(display "2.NEIIOIIAIE" submenuw) )
;Aiaaaeaiea
(define (adding)
(define ch)
(submenu)
(Window-Set-Cursor! mainw 22 30)
(display "AAO AUAI? :" 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)
;Aiaaaeaiea aieacie
(define (add_ill)
(define n)
(window-set-cursor! addiw 1 1)
(display "Aaaaeoa iacaaiea iiaie AIEACIE: " addiw)
(set! ill (read-line addiw))
(display " ?oiau CAEII?EOU aaiaeou neiioiiu IAAA?EOA: end" addiw)
(newline addiw)
(set! n (caar (last-pair *symptom*)))
(set! *it_is* (append *it_is* (list (list ill
(addsyms (+n 1) '() '() addiw)))
)) )
;Aiaaaeaiea neiioiiia
(define (add_sym)
(define n)
(define nums)
(window-set-cursor! addsw 1 2)
(display "AIEACIU: " addsw)
(set! ill (read-line addsw))
(display " ?oiau CAEII?EOU aaiaeou neiioiiu IAAA?EOA: 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 " NEIIOII: " 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)) ))
;?aaaeoe?iaaiea
(define (redacting)
(define ch)
(submenu)
(Window-Set-Cursor! mainw 22 30)
(display "AAO AUAI? :" 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)) ))
;?aaaeoe?iaaiea aieacie
(define (red_ill)
(define nums)
(define ill1)
(window-set-cursor! rediw 1 1)
(display " Aaaaeoa AIEACIU, iacaaiea eioi?ie oioeoa" rediw)
(newline rediw)
(display " ENI?AAEOU: " rediw)
(set! ill (read-line rediw))
(newline rediw)
(display " Aaaaeoa ENI?AAEAIIIA iacaaiea: " 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)) )) )
;?aaaeoe?iaaiea neiioiia
(define (red_sym)
(define n1)
(define nums)
(define sym1)
(window-set-cursor! redsw 1 1)
(display " Aaaaeoa AIEACIU, NEIIOII eioi?ie oioeoa" redsw)
(newline redsw)
(display " ENI?AAEOU: " redsw)
(set! ill (read-line redsw))
(newline redsw)
(display " Aaaaeoa NEIIOII, eioi?ue oioeoa" redsw)
(newline redsw)
(display " ENI?AAEOU: " redsw)
(set! sym (read-line redsw))
(display " Aaaaeoa ENI?AAEAIIIA CIA?AIEA: " 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))) ))
;Oaaeaiea
(define (deleting)
(define ch)
(submenu)
(Window-Set-Cursor! mainw 22 30)
(display "AAO AUAI? :" 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)) ))
;Oaaeaiea aieacie
(define (del_ill)
(define nums)
(window-set-cursor! deliw 1 2)
(display "Aaaaeoa iacaaiea AIEACIE, eioi?o? oioeoa" deliw)
(newline deliw)
(display " OAAEEOU: " 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))) ))
;Oaaeaiea neiioiiia
(define (del_sym)
(define nums)
(window-set-cursor! delsw 1 2)
(display "Aaaaeoa iacaaiea AIEACIE, NEIIOIIU eioi?ie oioeoa" delsw)
(newline delsw)
(display " OAAEEOU: " delsw)
(set! ill (read-line delsw))
(display " ?oiau CAEII?EOU aaiaeou neiioiiu IAAA?EOA: end" delsw)
(newline delsw)
(set! nums (find_sym ill *it_is*))
(subdel nums ill) )
(define n0)
(define (subdel spis_nums ill)
(display " NEIIOII: " 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)))) ))