1 Medley for the Novice, Release 2.0 1 Medley for the Novice, Release 2.0 7. EDITING AND SAVING 1 7. EDITING AND SAVING 1 "7"7. EDITING AND SAVING 6 This chapter explains how to define functions, how to edit them, and how to save your work. Defining Functions(FUNCTIONS NIL Functions NIL NIL 1 SUBNAME DEFINING SUBTEXT defining) 1 DEFUN(DEFUN (Function) NIL NIL NIL 1) can be used to define new functions. The syntax for it is: (DEFUN ( ()) New functions can be created with DEFUN by typing directly into the Executive Window. Once defined, a function is a part of the Medley environment. For example, the function EXAMPLE-ADDER(EXAMPLE-ADDER (Function) NIL NIL NIL 1) is defined in Figure 7-1. `—‹џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЧњћУППџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЛїwНПпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЛћїЏПпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџзvячяпПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџяџћяпПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџя~џћяЏПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџзvяЛяwНПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџЛЧіћУпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџїџџџпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџћџџџПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ000€ С€€0Р00 €0000 С€Р00 €`pG€1ѓЯГ|ЬЮ=чЬ№‡Яž|рЯ38їŸ3Р}›уЯГЯ€gЯЗЯ€ˆHЂ@c6f3fgƒ36m™№ЬйГl03 ž ЬйЖ`1›6f6lРЦmЖf0€Œ c7ц3fу36mљѓЬйП`00 Œ<ЬйЗр1›66lРЦl6f c63f36m€ЬйА`600  lЬйЖ1›66lРЦl6f‰" c6f3fg›36m˜ЬйГ`603 žlЬйЖ`1›6f6lРЦl6frœ@aѓЦfЬЯГ7Ь№чЯž`р 3>Ьп3Р0ћ3УГЬРЧЬ6c€€0f0f€06лі€€Ь`a€иЦЦc€ЦР0РиЧЧ€{7МЯїЧ€ћчЯцoyёчЯ<ЦС€8Р<0РЦlРЫ6ffЦlРc6йГ6lЭ›6йd€ `f`ЦoРу6ffЦoРc6П6lЭ›іp‡р<```Цl;6ffЦlc606lЭ›‡рl```ЦlР›6ffЦlРc6Г6lЭ›6L€l`f`Цg€ёіfЦvg€;63ьЭёцx€>Р<`Р0РР0Р `a€љ„O>!уЧЯFШ Q$€€ЁFШ Q$€№AEH<Q'€B%O |‰$ €ЃхH љ$ %H ‰$€љ$H>‰уЧШ€pG€ˆHИ@0ƒ  ˆ‰ˆ r@€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ Figure 7-1. Defining the Function EXAMPLE-ADDER Now that the function is defined, it can be called from the Executive Window: `—џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрр?џџјџ_xwїџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџряџџџї~юїЗћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџряїqуџ~ѕяїћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџррzюнќ§ћяї§џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџря§рпџ}ћяї§џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџря§япџ}ѕяї§џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџряњюнї}юїЗ§џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрр7qујўпxp;џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџўџџџћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџџџџїџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџр``!D`@уˆ````````у` H`a„` B`!D`@уˆ``````Р  р`Р 0Œ`у<Ьуо|Я8|љчР<0Œ` H fx33fйŸ Э›6Р ``a„ ~0ѓ3fпŸ<Э›і Р†` B `1Г3fиlЭ› €†`!D fyГ3fй€lЭ›6 †`@уˆ <Ьћ3|Я>|љц №`` `` ````````````````` >@ €` @ ‚ ` XpФM€xтУ€,Xpрˆ›,8Ар‡`dˆ$J€" ƒ$@2d‰H•2DЩˆ€`Dј„J€" ‚'Р"@љ№H•"|€Р†`D€DJ€" ‚$"@H•"@€ `Dˆ$Ъ€" ’$@ "@‰I•2Dˆ€`DpУJ€ b#€"@pрF•,8€р‡```````````````````р` ˆ`b„` ‚`!Ф`@рˆ````````р` ˆ`b„` ‚`!Ф`@рˆ````````р` ˆ`b„` ‚`!Ф`@рˆ``````џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџрџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџр Figure 7-2.. After EXAMPLE-ADDER is defined, it can he executed The function returns 6, after printing out the message. Functions can also be defined using the editor DEdit described above. To do this, simply type (ED function-name 'FUNCTIONS) You will be told that no definition exists for the function, and a menu will pop up asking you what type of function you would like to create: `АџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџЧњћУППџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџЛїwНПпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјЛћїЏПпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјзvячяпПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјяџћяпПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјя~џћяЏПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјзvяЛяwНПяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјЛЧіћУпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџїџџџпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџћџџџПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјˆтШBШBЈBЈB˜B˜Bˆур`1РŽ0`3˜ pG€1урЯОЭёчйчЧŒˆHЂ@c6`#ГЭ›36l†0ƒ& cі`ГЭ›6n šc`ГЭ›6c†‰Ђ c6`ГЭ›36i†r@aур}™сйцo€0 0 јсРШ‘|pт#€@ ™"!$@  Ар™"!$@ xqaЧ‡,ё "Щˆ• !Ѓ" B2 ‰• ! €> B" ‘‰“"!d@ B" ‘"‰“"!d@" BA"€сРˆрpт#€  A"pРС8€ €ˆ@€@€ˆрC‡8бЧ‡XсРŽ№тРDйВ Ž<8АуУ‡aDHˆ2""d‚ ‘"A €&DЉR ‘Ш!ˆ™№GШ<т>@‚ Œ>A€"DЉR Ÿˆ!ˆ‘‰DD @‚ ‚ A€"DЉQ@ˆ!ˆ‘‰DH‰D2""@’ ‘"A€&LЉQ@ ‘ˆ! ˆ‘pрC‡<бТ@aРŽ@т€4ЉP€Žˆ Р‡€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџјџџџџџџџџџџџџџџџџџџџџџџџџќ№яџїџџпёџџЧџџџћџџџџџћў?ќяПяџїџџпїџџџпџџџћџџџџџћўџќяјю?‹{Lщп‹Œ(ь№їmлЗюћ›ЗgnЫньНпs{3fmпsvчlџplїјћи7o`пнэџ{{wnюП{я|џЗэћїцћлїooпнэќп{{wnюП{~я|яЗmлЗюћ›Зonпнэ§пsswnяsvя|№xю HˆC ˆB@"AD ŸфA?‚@"ACР€€€€Ÿчц ?€ˆ ! ˆ@H(@  OЧХ(@  HЄD@? HЄ|@  ˆD‚! ˆ@ŸфD‚ ‡€€€€€ŸчтA  ќˆa  HQ ‰OЧТI IјHI IHE )ˆC ŸфA? ќ€€€€ŸчфˆHˆOЧФHHHH(ˆŸфт€€€€ŸччУљјOчрˆ"˜HH”HOЧФё№’OФH’HрH‘Hˆ"ШŸфУљOф€€€€Ÿ €@@@€€@@@G‹‰сfDpHK1f"G=pHL@™"Hˆ"ШLЩ™"Ш‘ˆHH@PјHH‰O‘HH@2h€2HH‰HˆH@"Dˆ"ШШ‰Ш‘Ÿˆ@aBpGH‰G€€0џџџџџџџџџџџџџџџџџџџџџџџџџќ Figure 7-3 Selecting a Function Template Selecting the appropriate type will pop up an editor window with a function template. The use of the editor is explained in the Using the List Structure Editor section below. Simple Editing in the Executive Window 1 First, type in an example function to edit: 3/41> (defun your-first-function (a b) (if (> a b) '(the first is greater) '(the second is greater))) To run the function, type: 3/42> (YOUR-FIRST-FUNCTION 3 5) (THE SECOND IS GREATER) Now, let's alter this. Type: 3/43> FIX 41 Note that your original function is redisplayed, and ready to edit. (SeeFigure 7-4.) `ŒhџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўРџџёўО№яяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўпџџџю§няoїџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўпюуЧў§ыпяїџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўРѕнЛљћїпяћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўпћСПўћїпяћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўпћпПўћыпяћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўпѕнЛюћняoћџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўРnуЧё§О№рwџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџ§џџџїџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџўџџџяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўD‰"&H„DШD‰р‚т%HDЈD‰Cфљ%HDЈD‰ "$Ш„D˜D‰"$Ш„D˜8qФG8ˆРР8x8O >й€Xx"СЯи !B֘BDЦќ"CфЯ€Dй€ ќ§ћŒ 3ц7РЗЧŸ€~Цу>~Яœ` Œ ЦСƒЬ 666`6lЦ`Цѓcио`p ЦO  ЦСƒЬf66`6n`Цѓcио`p Ц"СЦљѓlЦ66gп6g†|Цл`ил`0иƒ !BЦСƒl†67Чи7УЦ`Цл`ил`0и УBDЦСƒ<†66`6`Ц`ЦЯcийр0ј У"CфЦСƒ<†66`6lЦ`ЦЯcийр1Œ У€Dќ§ѓƒуц`6o†`|Ч>ߘр1Œƒ   Зр РјР6`Ь`60Ь`7Р0 €ј060 €Ь0600€Ь060`РЬ060РРј0``€ РaПc~эёчрg€|љјCїяŒc c` ›1€lРЦЭ€рЦ Ц# c` ›€nРЭ€рЦ ЦF |Э™с€g€ЮЭёАЧЬУ c` №ё€cРЦљАЦƒ c` ˜1€`РЦЭ№Ц У c` ›1€lРЮЭƒЦ У c~ ›с€o€vЭћЧьУ€ aПc~ЯЯœoРg€|љјCїяŒ0Рc c`lиоl`lРЦЭ€рЦ Ц`# c` иоl`nРЭ€рЦ Ц`F |ߘлl`g€ЮЭёАЧЬУ 0 c`ьлl`cРЦљАЦƒ 0 c`lийь``РЦЭ№Ц У 0 c`lийь`lРЮЭƒЦ У 0 c~ЯЯ˜яРo€vЭћЧьУ 0``€ 0Рџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџўџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџў Figure 7-4. Using FIX to Edit a Fundion Move the text cursor to the appropriate place in the function by positioning the mouse cursor and pressing the left mouse button. Delete text by moving the caret to the beginning of the section to be deleted. Hold the right mouse button down and move the mouse cursor over the text. All of the highlighted text between the caret and mouse cursor is deleted when you release the right mouse button. If you make a mistake, deletions can be undone. Press the UNDO key on the keypad to the left of the keyboard. Now change GREATER to BIGGER: 1. Position the mouse cursor on the G of GREATER, and click the left mouse button. The text cursor is now where the mouse cursor is. 2. Next, press the right mouse button and hold it down. Notice that if you move the mouse cursor around, it will blacken the characters from the text cursor to the mouse cursor. Move the mouse so that the word "GREATER" is highlighted. 3. Release the right mouse button and GREATER is deleted. 4. Without moving the cursor, type in BIGGER. 5. There are two ways to end the editing session and run the function. One is to type Control-X. (Hold the Control key down, and type X.) Another is to move the text cursor to the end of the line and crљ In both cases, the function has been edited! Try the new version of the function by typing: 3/48> (YOUR-FIRST-FUNCTION 8 9) (THE SECOND IS BIGGER) and get the new result, or you can type: 3/49> REDO 42 (THE SECOND IS BIGGER) Using the List Structure Editor 1 If the function you want to edit is not readily available (i.e. the function is not in the Executive Window, and you can't remember the history list number, or you simply have a lot of editing), use the List Structure Editor(LIST% STRUCTURE% EDITOR NIL List% Structure% Editor NIL NIL 3), often called SEdit. This editor is evoked with a call to ED: 81Ќ(ED 'YOUR-FIRST-FUNCTION 'FUNCTIONS) Your function will be displayed in an edit window, as in Figure 7-5. If there is no edit window on the screen, you will be prompted to create a window. As before, hold the leff mouse button down, move the mouse until it forms a rectangle of an acceptable size and shape, then release the button. Your function definition will automatically appear in this edit window. `VŠ?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?§ЗяМ=і№;СР| іћУ€оћќџїџџџџ}сп§їџџР>ћ§її{ніћїћ}Оћ§§і{Нїню{§яџїџџџџЛоп§іћОџџР>џХЁїwэіћїћ}Пћ§§іЛїліЛ§юћЙЗ§ћніћїћ}Оћ§§іѓНїнюѓ§§лЗnмнџЛоп§іћОџџР?ХЙ§ќ>ћїћ}Сћ§ўћУїоћ§ў,wБbуП}сРўОџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџоџПџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџсџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР0Р0Р0Р0Р0Р0Р0#ѓїьn0G<јуУ€>Dˆуу‡ Р0# o0H‘"€B$B DЩ™PAР0C o0ˆ‘"€B$B DЩ™ P@€Р0CчЬmАˆ‘<№CУDјЧЧ"xсР>љѓСР0D€$‘2DB ‘ (!!Р0D€$‘2DB ‘ (! Р0|№‡ˆ*DA€<(!уРР0D€D*D@@ ” D!€Р0D€$‘&DB ’ |!@Р0D€$‘&DB ‘ D! Р0DјЧЧ"xсР>D!ђ!Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР Figure 7-5. An Edit Window Many changes are easily done with the structure editor. Notice that by pressing the left mouse button you can place the caret in position, and by pressing the middle mouse button you can select atoms or s-expressions. Repeated pressing of the middle button selects bigger pieces of text. To add an expression that does not appear in the edit window (i.e., it cannot simply be underlined), place the caret at the insertion point and type it in.. For example, to replace the first GREATER with LARGER, place the caret to the left of GREATER, as shown in Figure 7-6. `VŠ?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?§ЗяМ=і№;СР| іћУ€оћќџїџџџџ}сп§їџџР>ћ§її{ніћїћ}Оћ§§і{Нїню{§яџїџџџџЛоп§іћОџџР>џХЁїwэіћїћ}Пћ§§іЛїліЛ§юћЙЗ§ћніћїћ}Оћ§§іѓНїнюѓ§§лЗnмнџЛоп§іћОџџР?ХЙ§ќ>ћїћ}Сћ§ўћУїоћ§ў,wБbуП}сРўОџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџоџПџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџсџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР0Р0Р0Р0Р0Р0Р0#ѓїьn0G<јуУ€>Dˆуу‡ Р0# o0H‘"€B$B DЩ™PAР0C o0ˆ‘"€B$B DЩ™ P@€Р0CчЬmАˆ‘<№CУDјЧЧ"xсР>љѓСР0D€$‘2DB ‘ (!!Р0D€$‘2DB ‘ (! Р0|№‡ˆ*DA€<(!уРР0D€D*D@@ ” D!€Р0D€$‘&DB ’ |!@Р0D€$‘&DB ‘ D! Р0DјЧЧ"xсР>D!ђ!Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р0Р?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР?џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР Figure 7-6. Caret Placement Prior to Changing GREATER with LARGER Now press the DELETE key seven times, and type in LARGER. The window now looks like this: `T‰џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€`€`€`€`€`€`€`€`€`€`€`€`€`€`€`€`€`€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ƒ€ўлїоћјрр>ћ}сРo}ўџћџџџџО№яўћƒ€Рџ€}_}ПўћћНюћ}ћ§Оп}ўўћ=оћюї=ўїџћџџџџняoўћ}Пп€~?ПтаћЛіћ}ћ§Оп§ўўћ]Пћэћ]ўї;ИёqпыпяўћПп€}_‡мл§{іћ}ј=Ос§ўћmПћэћmўіэлwnnпїпяўћ‡п€ћПолўћіћћ§ў§ўўћmПћэћmўњќo`џїпяўћћПРџ€џ§Полўћіћ}›§Оџ}цўћuПћэћuўўmљsooџыпяцћ§Пп€џ}Пмлў§юћ}ћ§Оп}ўўћyоћюїyўўэлЗnnџняoўћ}Пп€џƒ€тмўў}ћ§Ор§ўџ}сћя}ўџ;иБqпО№рƒ€п€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџяпџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџ№џџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€`€`€`€`€`€` €`Gчяим`Ž"xёЧ‡|‰ЧЧ" @€`F6 о`‘"D„H„@‰’!2  ‚€`†6 о`"D„H„@‰’!2@ €`†7ߘл`"xр‡†x‰R*@ €`†6 л`"Pљ…>@‰R*AA€`†6 йр"H„ˆ„@‰2!&A№A€`†6 йр"D„H„@‰2!&AA€`Gчь˜рDФG@qС"!‚€`@ €` €`€`€`€`€`€€`€€€`@@ €` @ €` @€`  ‚€` р‚€` @ ‚€`€ €`€`€€`€`€`€`€`€`!ђ'Рxq№‡ №уч‚€` B$Dˆ@€ (‰B€`@B$Dˆ@€ (‰A€`@Cч€x`@ (ёЧ€`@B$P@ DЁr€`@B$Hˆ@€ |‘€`@B$Dˆ@€ D‰A€` B'РDp@‡>DˆуфB€` €`€`€`€`€`€`€`|‰№ŽD№У€<|!ѓч‚€`‰H"dˆ„@"@PBB€`‰H"dˆ„@"@PBA€`љр"Tˆƒˆ  h €Р !"ˆ ‘"D  €Рq"№@ŽBёш@Р@Р€€РРРРР@Р"|ёЧ‡8p>x Р"@„H„ˆˆ‘ D Р"@„H„ˆˆ‘ DР>xр‡†`D Р Р@РРРРР@@€Р@‡ШŸ8јсФO8уЧТ>x @Р@D&H€D$ D @РAD&H€D$ D Рž0ё%H€0Ч…D @Р€ @Р@@€РРРРРР Р Р˜ #ФD"'gбтсРР˜ $$D"(Ј‚2 Р $"ЈO‚рРЄ"ЈHР˜d!ˆ‚2 Р˜#С‡бтРРˆРˆРРРРР РРРРРРРРРР РРРРџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџРџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџР Figure 7-8. Placement of Comments There are other editor commands which can be very useful. To learn about them, read Appendix B of the Release Notes. File Functions and Variables: How to See and Save Them 1 With Medley, all work is done inside the Lisp environment. There is no operating system or command level other than the Executive Window. All functions and data structures are defined and edited using normal Lisp commands. This sertion describes tools in the Medley environment that will keep track of any changes that you make in the environment that you have not yet saved on files, such as defining new functions, changing the values of variables, or adding new variables. And it then has you save the changes in a file you specify. All of these functions are in the INTERLISP (IL:) package. File Variables(FILE% VARIABLES NIL File% Variables NIL NIL 5) 1 Certain system-defined global variables are used by the file package to keep track of the environment as it stands. You can get system information by checking the values of these variables. Two important variables follow. џџяfџ FILELST evaluates to a list, all files that yoU have loaded into the Medley environment. џџяfџ filenameCOMS (Each file loaded into the Lisp environment has associated with it a global variable, whose name is formed by appending COMS to the end of the filename.) This variable evaluates to a list of all the functions, variables, bitmaps, windows, and soon, that are stored on that particular file. For example, if you type: MYFILECOMS the system will respond with something like: ((FNS YOUR-FIRST-FUNCTION ) VARS)) Saving Interlisp-D on Files 1 The functions (FILES?) and (MAKEFILE 'filename) are useful when it is time to save function, variables, windows, bitmaps, records and whatever else to files. (FILES?) displays a list of variables that have values and are not already a part of any file, and then the functions that are not already part of any file. Type: (FILES?) the system will respond with something like: the variables: MY.VARIABLE CURRENT.TURTLE...to be dumped the functions: RIGHT LEFT FORWARD BACKWARD CLEAR-SCREEN...to be dumped want to say where the above go? If you type Y, the system will prompt with each item. There are three options: 1. To save the item, type the filename (unquoted) of the file where the item should be placed. (This can be a brand new file or an existing file.) 2. To skip the item, without removing it from consideration the next time (FILES?) is called, type crљ This will allow you to postpone the decision about where to save the item. 3. If the item should not be saved at all, type ]. Nowhere will appear after the item. Part of an example interaction is shown in the following figure: ffЩџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€јџџџэОР@`wћƒƒПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ћџџџџнžћпяЗћ}Нпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ћ§мxџнЎћпяЗћНпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€јЛЗНЖћРяЗћ‡Няџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ћџx7џНЖћпрwћћƒяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ћџ{їџНКћпяЗћ§Пяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ћўЛЗНМћпяЗћ}Пяџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ј мxџнОћРoА;ƒПпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџпџџџџџџџџпџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџяџџџџџџџџПџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€РПlž0€Р0l33€Чп0l83€Ф >l €Ч„|0l €РH 0l €ФH0l3 €Уˆ0oпО €Р€Р€Р€0€Р€Р€ЧР €С €С,8в&Ы€С€2D2%L‘&€С€"|%HŸ"€С€"@%H"€С€2D2eL‘&€С,8бЅK€Р€Р€Р€Р€Р€ФO‘>8№@‡‡Dљуˆ8ˆр€ЦH @DH€d"Dй€ЦH XqaЃ‡<8DH„dR"Dй€ХO<р"d ’dH€DЁG†TёSС DЈР€ХH  Dy'ЦDЂ%TR DЈ €ФШ  D‰$DЃфˆ€L€Ђ"DЉ€ФШ "D‰dH€DB$H„L€Ђ"DЉ€ФOŠ 8љ№DyЃ‡ 8B$GDјЂŸ8ˆр€Р €РЈЈЈЈА#€>|q№€Р$@@ˆ@€Р$B@ˆ@€РтЃx`@€Р €@@€Рd@@ˆ@€РdB@ˆ@€Р#‚|p@€Р€Р€Р€Р€Р€Рpp@ˆР€Рˆ@€и" €РXРˆуfЧ@pтР,Dqт%‡й'‹x€Рd "ЅH™@ ˆ2Dˆ‚&H‘Љ‚ ‘" €РD€>ЅH‘@Т  D€‚$ŒЉB €РD@ ‰ЅH‘@"  D€‚$ЈЂ" €Рd2 ‘"‰ЅH‘@ ‰ Lˆ’d‘ЈЂ"H"$€РXбРpтЅG|тР 4paЄˆAСˆ €Р@@€Р@€€Р€Р€Р€Рp8Р€Р@ €РXРёУXp@–xpтР€Рd "A$D"dˆ@ˆ™"  €РD€>A$"D`‘  €РD@ A$"D‘  €Рd2 ‘"A2$D‚"Dˆ@ ‘"$ €РXбР@в#ƒDp@‘т €Р@€Р@€Р€Р€Р€Р€ Р€Р@€  €ФG<№р‡DАтУ€,8тУˆŽ4p Ž€Ф@™A@‘DЩ$@2D$H‘Lˆ@‘"€ХG‘A‘T‰ђР"|ђ$EDˆ€Ÿ€ХH‘AˆŠT‰"@$EDˆ€Тˆ‘IHŠ(‰@ "D$BLˆ€"€Т‡‘ 0р‡„(ˆт€"8ђУ‚4p€€Р€Р8 €Р€Р€Р€€С€€С€€€€ТŽ6lq`,qтФG"Xpр@€Т*T‰2ˆƒ$Hˆ"d‰@€Т*T‰ "`‚H"@јР@€Т‘*T‰"‚H"@€ @€Т‘*T‰2ˆ’Ш‰&@‰@€С*TqС,pbG@pр€€С €€Р€ €Р€Р€Р€Ф@€€ЦР€€ЦШ‘|@€Р€Р€Р€Р€Р€ЧР Ч>8qШ‘|pт#€>8p€С ‘ ‰™"!$@ Dˆ€С,8сЦЫ8h@‘ ‰™"!$@ Dˆ€С€2D%L‚D˜@ˆž<Pˆ• !Ѓ8qpт#‚ 8p€Р€Р€Р€Р€Р€ЧР р@рƒˆŸ"ёЧŽDђ$G8ˆрŽсФO>xqѓФO€€С A „"$H"d&H„DЩ"$H„ D‰$H€С,8!УA „*$H"d&H„DЩ"$H„ D‰$H€С€2D DD&A „*т' Tт%HDЈР"$ODqђ!€€Р€€Р  €Р€Р€Р€Р€Р€ЧЮ€Ф €ЧŽ|€РQ €ФQ€УŽ€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€Р€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ€ Figure 7-9. Part of an interaction using the function FILES? (FILES?) assembles the items by adding them to the appropriate file's COMS variable (see the File Variables section above). (FILES?) does NOT write the file to secondary storage (disks or floppies). It only upclates the global variables discussed in the File Variables section above. (MAKEFILE 'filename) actually writes the file to secondary storage. Type: (MAKEFILE 'MY.FILE.NAME) and the system will create the file. The function returns the full name of the file created. (i.e. {DSK}MY.FlLE.NAME.; 1). Files written to (DSK) are permanent files. They can be removed only by the user deleting them or by reformatting the disk. Other file manipulation functions can be found in Chapter 4.(LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "") STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (TEXT NIL NIL (54 54 504 690) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (54 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL)))))!,llр2llрЂ8HHр~Ђ8HHр~Ђ2llрT2llрT8Hр~Ђ8HЂр~Ђ8Hр~Ј2HHрZ5Hр~2HHр Z2HHрZ2HZрZ8llр„œД8llр„œД2llр„,lHр2HTрT,HHр,HHр ,HHр,HHр -рT-рT,HHр2рр5рЬрFјј PAGEHEADING VERSOHEADFјј PAGEHEADING RECTOHEADEјј PAGEHEADINGFOOTINGVEјј PAGEHEADINGFOOTINGR, ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) CLASSIC TITAN CLASSIC TITAN  HELVETICACLASSICMODERN HELVETICACLASSIC  HELVETICA MODERN  TIMESROMAN   HRULE.GETFNMODERN   "   HRULE.GETFNCLASSIC  #    HRULE.GETFNCLASSIC      HRULE.GETFNCLASSIC    IM.CHAP.GETFN HELVETICA  HRULE.GETFNMODERN! [  EIM.INDEX.GETFNCLASSIC  HRULE.GETFNCLASSIC!  IM.INDEX.GETFN= =" ‡ (IM.INDEX.GETFN ! H BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) "  ! N ! А BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8))   8 ^     "l BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) ( Ў  ' HRULE.GETFNCLASSIC, - &* !  U ! ! \ BMOBJ.GETFN3?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8))  * ! ~  X    $  U г  &  &  _ ' q   /   )   HRULE.GETFNCLASSIC!  р ?IM.INDEX.GETFN;    # !  E  + ! !  Ф BMOBJ.GETFN3CLASSIC    !  "  П  !   Ф BMOBJ.GETFN3CLASSIC   .    2 #  ˜ BMOBJ.GETFN3CLASSIC      І #IM.INDEX.GETFN(  HRULE.GETFNCLASSIC! W  U " BMOBJ.GETFN3CLASSIC   " f   7 HRULE.GETFNCLASSIC:   /IM.INDEX.GETFN HRULE.GETFNCLASSIC! о   R   y І   .   HRULE.GETFNCLASSIC   o    •     0  > L #!  Q • L ` X  C ! :F BMOBJ.GETFN3 TIMESROMAN  6   > 2 ˜ !   2  d   f ! < /ŠЇzК