CHAPTER8THEPROGRAMMER'SASSISTANT8.1INTRODUCTIONWithanyinteractivecomputerlanguage,theuserinteractswiththesystemthroughan``executive'',whichinterpretsandexecutestyped-incommands.InmostimplementationsofLisp,theexecutiveisasimple``read-eval-print''loop,whichrepeatedlyreadsaLispexpression,evaluatesit,andprintsoutthevalueoftheexpression.Interlisphasanexecutivewhichallowsamuchgreaterrangeofinputs,otherthanjustregularInterlispexpressions.Inparticular,theInterlispexecutiveimplementsafacilityknownasthe``programmer'sassistant''(or``p.a.'').Thecentralideaoftheprogrammer'sassistantisthattheuserisaddressinganactiveintermediary,namelyhisassistant.Normally,theassistantisinvisibletotheuser,andsimplycarriesouttheuser'srequests.However,theassistantrememberswhattheuserhasdone,sotheusercangivecommandstorepeataparticularoperationorsequenceofoperations,withpossiblemodications,ortoundotheeectofspeciedoperations.LikeDWIM,theprogrammer'sassistantembodiesanapproachtosystemdesignwhoseultimategoalistoconstructanenvironmentthat``cooperates''withtheuserinthedevelopmentofhisprograms,andfreeshimtoconcentratemorefullyontheconceptualdicultiesandcreativeaspectsoftheproblemathand.Wewillrstdiscussthevariousinputformats,thentheuseofcommandstotheprogrammer'sassistant,andnallyhowtomodifytheprogrammer'sassistantforspecializeduses.8.1.1InputFormatsTheInterlispexecutiveacceptsinputsinthefollowingformats:(1)Asinglelitatom,followedbyacarriage-return.Thevalueofthelitatomisreturned.Forthepurposesofthisdiscussion,wewillcallthisEVALV-format.(2)AregularInterlispexpression,beginningwithaleftparenthesisorsquarebracketandterminatedbyamatchingrightparenthesisorsquarebracket.Arightbracketmatchesanynumberofleftparentheses,backtothelastleftbracketortheentireexpression.Suchaninputisknownasan``EVAL-format''input,sincetheformissimplypassedtoforevaluation.Noticethatitisnotnecessarytotypeacarriagereturnattheendofsuchaform;Interlispwillsupplyoneautomatically.Ifacarriage-returnistypedbeforethenalmatchingrightparenthesisorbracket,itistreatedasaspace,andinputcontinues.Thefollowingexamplesareallinterpretedthesame:8.1EVAL_(PLUS1(TIMES23))_(PLUS1(TIMES23]|\%,V!= -K i xG  Z "%'-R0^27<@>" EEv `)%k'E*56:U<BDFE|C  } "&N'u* 17r9;?B'DH&B*  \ S#(,K-1m69;@YDG>@  =  ;! ().3c5@7 Ad G;  %e*+.035& ;=As :4 1 {% &''-K/157<{@CF 8 3%2(+.04k6=8;>HABH06 7 cB#!$ +.4 <>@ECF+5C  I { #= +1W7}9n?iAE3  ]GG! (+ 369,<=@ H&1  %R< $(++k-x/ 6 =b@E90Q  -L  y&!_&),A.0u7X9 ;l D' +  y2 %F*, 3|'B ix"  59!"%)+5   ^Z$(+/0379?.AD2  B <n $S-   W %I(e), 3/49\>;@ G e O!'(+06%8=?B"    xX"~ )-.238R9;@E<  \ \"%( ,L0346M8>@~CD /U#:|~% ',R/ 8L9;'@CDF  A% $P&+\,./2459<@B GJ B0 !<#(!}0`m$Px< E {]  {] "}0(`m$(Examples(3)Often,theuser,typingatthekeyboard,callsfunctionswithconstantargumentvalues,whichwouldhavetobequotediftheusertypeditin``EVAL-format''.Forconvience,iftheusertypesalitatomimmediatelyfollowedbyalistform,thelitatomisedtotheelementswithinthelist,unevaluated.Forexample,typingisequivalenttotyping,andisequivalentto.Theinputisterminatedbythematchingrightparenthesisorbracket.Wewillcallsuchinput``APPLY-format.''APPLY-formatinputisusefulinsomesituations,butnotethatitmayproduceunexpectedresultswhenanfunctioniscalledthatexplicitlyevaluatesitsarguments.Forexample,typingwillsettotheof,nottoitself.However,therearetimeswhenauserdoesnotwanttoterminatetheinputwhenaclosingparenthesisistypedespeciallywhengivingacommandtotheprogrammer'sassistant.Thisleadsustoourfourthformat.(4)Asequenceoflitatomsandlistsalitatomandaspace(todistinguishitfromAPPLY-format),terminatedbyacarriagereturnoranextrarightparenthesisorbracket.IfalististerminatedthenInterlispwilltypeacarriage-returnandtoindicatethatfurtherinputwillbeaccepted.Theusercantypefurtherexpressionsorterminatethewholeexpressionbyacarriage-return.Oncetheinputisterminated,theprogrammer'sassistantdecideshowtoevaluatetheexpression.Thisdeterminationreliesonaheuristicthatsays``Ifthereisonlyexpression,thenassumeEVALV-format.Iftherearetwoexpressions,thenassumeAPPLY-format.Iftherearethreeormoreexpressions,thenassumeEVAL-format.''Thefollowinginputsareexamplesofthisrule:8.1.2ExamplesSofar,wehavedealtonlywithhowtheexecutiveinstructsInterlisptoevaluateinput.However,thesameschemealsoallowstheusertogivecommandsdirectlytotheprogrammer'sassistant.Infact,ineachoftheabovecases,itisrstdeterminedwhethertheinitiallitatomisacommandtotheprogrammer'sassistant.Ifso,thenormallispevaluationprocessisbypassed.Notethatthismeansthatafunctionorvariablewiththesamenameasaprogrammer'sassistantcommandwillnotbeevaluated(inthenormallispsense)ifitistherstlitatomofanexpressioninputtotheexecutive.Theprogrammer'sassistantfacilityfeaturestheuseofmemorystructurescalled``historylists.''Ahistorylistisalistoftheinformationassociatedwitheachoftheindividual``events''thathaveoccurredinthe8.2_(PLUS1(TIMEScr23]APPLYLOAD(FOO)(LOAD'FOO)GETPROP(XCOLOR)(GETPROP'X'COLOR)nlambdaSETQ(FOOBAR)FOOvalueBARBARbeginningwith"..."_FOOcrsameasFOOcrEVALV-format_LIST(AB)...crsameasLIST(AB)APPLY-format_PLUS(TIMES23)...1crsameas(PLUS(TIMES23)1)EVAL-format|b1&xU  s@6%(+.21Y6=AETA  R#5!"$Y)R/f22 9:=@/CE/R VMs f"'l-.028<?DA P   'O)67HsOP "g#&*a+ 247k={@ HM Ho#~)&.526J7;=f@ G^L  6= %2(0\57H;A> CJ_  J*-24B:>J?AF-GZ /&!%'+,25c9<>B E  T& 4 '&(+* 3; 9<1?AuC ED A   <o%)*8.126{8 ?@DJ?c J GS#$&*\- 46@G<  kx R &8(, 3Q5K6s;9  ] 6 (-~2s57T<?C F7m  "%'+-/0h 7:?E5   I -$).V/359;i? F4! y!%(-/2Q|> ix  Nb"0("-249=DFc3 l t'q,.I0 9 ?ADF  *=  #5(+/35E6<>A'  ( $A) *1%47:2>A]BHB $B& ',3M58u:j@BE%  H~ 5"$ (,}.*0  vV$|&)K+0i 6:?CEP  1 H  #F&h)+b- 4P 9<@EG("}D`m$xZ {zZ6xX R(P-h2r:gBOPp{L*xJ_'/{6x;C,{A &x=%h1 z1Y{/vh!z/$%&{/v&@(2-x,+ {* z* !{(h!&(*0x% # z$W w {"Hh!&e, -J.026"}D`m$THEPROGRAMMER'SASSISTANTsystem,whereeacheventcorrespondstooneuserinput.Associatedwitheacheventonthehistorylististheinputanditsvalue,plusotheroptionalinformationsuchasside-eects,formattinginformation,etc.Thefollowingdialogue,takenfromanactualsessionattheterminal,containsillustrative(butnotnecessarilyuseful)examplesandgivestheavoroftheprogrammer'sassistantfacilityinInterlisp.Thenumberbeforeeachpromptisthe``eventnumber''(seepage8.26).8.312_(SETQFOO5)513_(SETQFOO10)(FOOreset)10Thep.a.noticesthattheuserhasresetthevalueofFOOandinformstheuser.14_UNDOSETQundone.15_FOOcr5Thisistherstexampleofdirectcommunicationwiththep.a.TheuserhassaidtoUNDOthepreviousinputtotheexecutive....25_SET(LST1(ABC))(ABC)26_(SETQLST2'(DEF))(DEF)27_(FORXINLST1DO(REMPROPX'MYPROP]NILTheuseraskedtoremovethepropertyMYPROPfromtheatomsA,B,andC.Nowletsassumethatisnotwhathewantedtodo,butratherusetheelementsofLST2.28_UNDOFORFORundone.FirstheundoestheREMPROP,byundoingtheiterativestatement.NoticetheUNDOacceptedan``argument,''althoughinthiscaseUNDObyitselfwouldbesucient.29_USELST2FORLST1IN27NILTheuserjustinstructedtogobacktoeventnumber27andsubstituteLST2forLST1andthenreexecutetheexpression.Theusercouldhavealsospecied-2insteadof27tospecifyarelativeaddress....|b'!= -x\:  !8"%(z, 3i6}9=V?WAF:HsZ  I~|r$l +/038! > FW  f!^#',.1S7~=( D'GjU ox>!$-(),S 5:?@ GTD ^r:#)s,=/(}`m$xQ> {O M {LM J {G  lV!#'W(,~/36HxD B AQ zA%x? {<   (+-}0x3L6B8;=_BAD;  lZ x7 6V 4 1 40  q._ { ,  q+ S # $)n {&i  Ey!'*-&1 247C9<=>CMFG|$  2 A} <"()x!    H{  jI!5&)6. 6:=(B;Gm =xd#1% (P,8.xh ] {  ? s  X!$)w+c. 48:5>%@C  6 D"p'(7)j-/13%78=vx l }`m$ExamplesAsstatedearlier,themostcommoninteractionwiththeprogrammer'sassistantoccursatthetoplevelread-eval-printloop,orinabreak,wheretheusertypesinexpressionsforevaluation,andseesthevaluesprintedout.Inthismode,theassistantactsmuchlikeastandardLispexecutive,exceptthatbeforeattemptingtoevaluateaninput,theassistantrststoresitinanewentryonthehistorylist.Thusiftheoperationisabortedorcausesanerror,theinputisstillsavedandavailableformodicationand/orreexecution.Theassistantalsonotesnewfunctionsandvariablestobeaddedtoitsspellingliststoenablefuturecorrections.Thentheassistantexecutesthecomputation(i.e.,evaluatestheformorappliesthefunctiontoitsarguments),savesthevalueintheentryonthehistorylistcorrespondingtotheinput,andprintstheresult,followedbyapromptcharactertoindicateitisagainreadyforinput.Iftheinputtypedbytheuserisrecognizedasap.a.command,theassistanttakesspecialaction.Commandssuchasandareimmediatelyperformed.Commandsthatinvolvedreexecutionofpreviousinputs,suchasand,areachievedbycomputingthecorrespondinginputexpression(s)andthenthem.Theeectofthisunreadingoperationistocausetheassistant'sinputroutine,,toactexactlyasthoughtheseexpressionsweretypedinbytheuser.Theseexpressionsareprocessedexactlyasthoughtheyhadbeentyped,exceptthattheyarenotsavedonnewandseparateentriesonthehistorylist,butassociatedwiththehistorycommandthatgeneratedthem.Theneteectofthisimplementationoftheprogrammer'sassistantistoprovideafacilitywhichiseasilyinsertedatmanylevels,andembodiesaconsistentsetofcommandsandconventionsfortalkingaboutpastevents.Thisgivestheuserthesubjectivefeelingthatasingleagentiswatchingeverythinghedoesandsays,andisalwaysavailabletohelp.8.447_(PUTHASH'FOO(MKSTRING'FOO)MYHASHARRAY)"FOO"IfMKSTRINGwasacomputationallyexpensivefunction(whichitisnot),thentheusermightbecacheingitsvalueforlateruse.48_USEFIEFUMFOEFORFOOINMKSTRING"FIE""FUM""FOE"TheusernowdecideshewouldliketoredothePUTHASHseveraltimeswithdierentvalues.Hespeciestheeventby``INMKSTRING''ratherthanPUTHASH.49_??USE48.USEFIEFUMFOEFORFOOINMKSTRING_(PUTHASH(QUOTEFIE)(MKSTRING(QUOTEFIE))MYHASHARRAY)"FIE"_(PUTHASH(QUOTEFUM)(MKSTRING(QUOTEFUM))MYHASHARRAY)"FUM"_(PUTHASH(QUOTEFOE)(MKSTRING(QUOTEFOE))MYHASHARRAY)"FOE"Hereweseetheuseraskthep.a.(usingthe??command)whatithasonitshistorylistforthelastinputtotheexecutive.Sincetheeventcorrespondstoaprogrammer'sassistantcommandthatevaluatesseveralforms,theseformsaresavedastheinput,althoughtheuser'sactualinput,thep.a.command,isalsosavedinordertoclarifytheprintoutofthatevent.UNDO??REDOUSEunreadingLISPXREAD|b1&x.  '[ '*-5 6;?AD F,z  (Q3#<%({,- 46 =@C`E* \T}#&n*k-?.4S7 >%BE). 4Ag &`)@-<.0{148|:=ADH}'  Mv $'*,-.25U;=N E:%  "(+13248:a<+A-CE|$= ( '!'2) 14:=a@BG" Y D #%]'+=-:/46K ?2@C/G(  2Q!').01p58;  D(8o = '(*P-47j=@EqG 9t\! ) 08I;!@ H& fj!"b$*@,+25> >A   $ "i% +1348|: ADU{T-l!$ +/2468<]@Y G A!$)A-036#8<>AD X\GY "%(4,35<-  v "$ -24_6; <-@DF_ 4!#> )+-47e ? A\E  ? &o*-.268= DF   Y( }p`m$x\A 4 % Z {W  pFq!2'1,p023q69;>BDNU  MsxR *? # QE O M {J  ZO #&2-2$58=ByDIO  6o f!g$xFI B I!^$'?AX rS (.3 ? >  rS (.3 xW  x !r"')z049i<>eAFE{GV- y75e" )+<1479;w=?BWFS(  [U!$N'+-3.\1(79>NCE Q  \2[$! *,/ 69<N}  [ 0!$;&*P 149/; BF+L  ]2#')-$17i>NAUCJK2  >[ $M),/48<> EI |"_$+/58<;=A G  |C iF x?  T !#&&*-/_4r6A7=|?L G=w x#&*-n1Z35:<>EG; dT"&h,.(03j8;aAF+:,  xq!'+8--028^;=}BHs8 ST%])'*-#037<DeH06  6 )z#%c){-2[4:;hF 5:    h$&*/2(7:<>A.25  Eqe!S&,!.k26;> Ef0  U #6'g+.5:= AD!G.  In#z#k&),146;?BH}-D k> $/%)f-1]56:;k>@UDF++ (  sX7 %'A% X ^ &(j*>-268G:>!AD#` -#%',1$6B8^>? F+"H "!')6-1i35s9$; ?> Cp"&(x*07&;<@FH#J%'*07=;<?ECF+ X#/':*1'16p:qDMG"%h'W(,22;BA "^%e)*,.38R:@B.EG` ")+.3"7f:w<AEG 4 I "u%)+H-1Z6A79[;K@C (} 8`m$ x; 8#2>Ad68> @CD0 D-D 8A{C d!<43N5 ,{>xG1B } 88`m$Rx-D5 + %  #+"HJ9  kMOG578T!} p `m$>EventSpecicationofwhatitis.Forexample,looksforaneventcontaining.Speciesthatthenextobject(presumablyapattern)istobematchedagainsttheofevents,insteadoftheinputs.Speciestheeventlastlocated.Speciesaneventforwhichthefunctionreturnstrue.shouldbeafunctionoftwoarguments,theinputportionoftheevent,andtheeventitself.Seepage8.25foradiscussionoftheformatofeventsonthehistorylist.Anyothereventaddresscommandspeciesaneventwhoseinputcontainsanexpressionthatmatchesasdescribedinpage17.13.Thematchingisperformedbythefunction(page8.33),whichisinitiallydenedtocallbutcanbeadvisedorredenedforspecializedapplications.Note:Symbolsusedbelowoftheformrefertoeventaddresses,describedabove.Sinceaneventaddressmaycontainmultiplewords,theeventaddressisparsedbysearchingforthewordswhichdelimitit.Forexample,in,thesymbolcorrespondstoallwordsbetweenandintheeventspecication,andtoallwordsfromtotheendoftheeventspecication.Speciesthesequenceofeventsfromtheeventwithaddressthroughtheeventwithaddress.Forexample,speciesevents47,48,and49.canbemorerecentthan.Forexample,speciesevents49,48,and47(notereversaloforder).Sameasbutdoesnotincludeevent.Sameas.Forexample,ifthecurrenteventisnumber53,thenspeciesevents49,50,51,and52.Sameas.Forexample,ifthecurrenteventisnumber53,thenspeciesevents52,51,50,and49(notereversaloforder).Sameas.Speciesalleventssatisfying.Forexample,,.emptyIfnothingisspecied,itisthesameasspecifying.Note:Inthespecialcasethatthelasteventwasan,itisthesameasspecifying.Forexample,iftheusertypes,hecanthentype,followedby.8.6F-2-2=values\SUCHTHATHISTORYMATCHEDITFINDPFROMTHRUFROMTHRUTHRUFROMTHRUTHRUFROM47THRU49FROM49THRU47FROMTOTOTHRUFROMFROMTHRU-1FROM49THRUFROM-1THRUTHRU49TOFROM-1TOALLALLLOADALLSUCHTHATFOO-1UNDO-2(NCONCFOOFIE)UNDOUSENCONC1PREDPREDPREDPATPATEventAddressiEventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress1EventAddress2EventAddress2EventAddress1EventAddress1EventAddress2EventAddress2EventAddress2EventAddress2EventAddress1EventAddress1|b'#' x\:^ ",O/2$47 @%Y5R )"%) 128 9;M=GBGWi!&(\*TG#V%Qbl#9%),-5:tBFHO !L (?*.#246:=?CrGIN9 !8 ')k+0?16,80:?K4"'.]36 : >rBUGI X!$)6*125Fz q!(*,<@DjHsD!f#-~/2e4C9#:@B C= @8  {*7-/B2 9l?D4G>  k$H&*^/F057='?fAE< S23V5BC ;G   e] "$( 0;8<>B9   cr 3Q@%s'#+R.147D1 -.1pD~0W #.q13"6; EG4._+ 057:<?BH&,&ic #n&)-9(#d014;<?iDxHs! (-2&4a68;014;<?iDxHs_)4.357:T=/?9BH&mhc-c %$ 25F8gE! '8%&([*.2/ 7   %u(+.J147=n>@/ADvH0  !-#)+P-0ABDF g$.("}`m$x\:(o**>w?NY5 {WxT Q F2^ D%{<4&;G*E6 4P17P;> B<._!$p() (P&i#d *:.n/E!",&` !"$["&h !C"#c >B$F66P7' : /4}:_= g&)!}`m$xQ{1>*K4 YI&m''@8"_#$?)W<g <%_<*,\-~<1<:I;<J?@/EB)|)K) f)K (  H k'(2U'&i124%8#d|"#d!#2$U"(|O()+ O/h q ih&M'(-Fc H@c+K,-2C}d`m$BTHEPROGRAMMER'SASSISTANTEachoftheisaneventspecication.Thelistsofeventsareconcatenated.Forexample,isthesameas.Ifisthenameofacommanddenedviathecommand(page8.12),speciestheevent(s)dening.isaneventspecicationinterpretedasabove,butwithrespecttothearchivedhistorylist(seepage8.13).Ifnoeventscanbefoundthatsatisfytheeventspecication,spellingcorrectiononeachwordintheeventspecicationisperformedusingasthespellinglist.Forexample,willworkcorrectly.Iftheeventspecicationstillfailstospecifyanyeventsafterspellingcorrection,anerrorisgenerated.8.2.2CommandsAllprogrammer'sassistantcommandscanbeinputaslistforms,oraslines(seepage8.30).Forexample,typingandareequivalent.isusedtodenoteaneventspecication.Unlessspeciedotherwise,omittingisthesameasspecifying=.Forexample,andarethesame.[Prog.Asst.Command]Redoestheeventoreventsspeciedby.Forexample,redoesthelastthreeevents.[Prog.Asst.Command]Redoestheeventoreventsspeciedbytimes.Forexample,redoesthelasteventtentimes.[Prog.Asst.Command]Redoesthespeciedeventsaslongasthevalueofistrue.isevaluatedbeforeeachiterationsoifitsinitialvalueis,nothingwillhappen.[Prog.Asst.Command]Sameas.[Prog.Asst.Command]Sameas.Theevent(s)arerepeateduntilanerroroccurs,ortheusertypescontrol-Eorcontrol-D.[Prog.Asst.Command][Prog.Asst.Command]Sameas.Forallhistorycommandsthatperformmultiplerepetitions,thevariableisinitializedto0andincrementedeachiteration.Iftheeventterminatesgracefully,i.e.,isnotabortedbyanerrororcontrol-D,thenumberofiterationsisprinted.8.7ANDANDANDFROM30THRU32AND35THRU3730AND31AND32AND35AND36AND37@NAME@@LISPXFINDSPLSTREDO3THRUU6REDO5cr(REDO5)-1REDOREDO-1REDOREDOFROM-3REDOTIMESREDO10TIMESREDOWHILENILREDOUNTILREDOWHILE(NOT)REPEATREDOWHILETREPEATWHILEREPEATUNTILREDOREDOCNTEventSpec1EventSpec2EventSpecNEventSpeciLITATOMLITATOMLITATOMEventSpecEventSpecEventSpecEventSpecEventSpecEventSpecEventSpecEventSpecNEventSpecNEventSpecFORMFORMFORMEventSpecFORMEventSpecFORMEventSpecEventSpecEventSpecFORMEventSpecFORM|b'!= -}\[GxZ$&@(+ 369Y:?AQ Y+9m:<@AWj.VTe F"&4'(/.36$<6B{F"Rb$/OO<!Z%; -2 4m6I:=@EGN1!#&*K  X Ijh ~"&e .t3p 9;>BICF+Ii J*:+.r369\G Y  '*H-E/36_:=C F  I |A ix=T  2 2!#%i)*,124j7:W=AsD; !5 8Zw ).3 :wEG7  f !+54O683;?9B2X"$p(.V569o0Z $^-;?9B,u"l$#(M-6;=*b^ #%)@+'];?9B%d$)(B),.\04&9;BkC$$&V')-v15 5:=! ;?9Bfc5a;?9B?,-0h5l7= @-AEDi"N&([*.;?9Bk;?9Bc l  "' .0<= DGEG(  .y" ( /E135~:r5AC@G t  Iq(  (!}`m$x\[ Y$ &*-J03,7`ADOGWj #j&)K,Te 8kO Ii ?DCwE&G ;,`z<fx;7+'U-223 2X?DCwGH- ,CwG*b'] H$2! Hf'b,m4:a ',' k 6( }`m$x\[  H k[4\[Z|[F\[#%9&[[)%Z A!cZL$-Te  BR)+,O q %8  H k@AnB73|2X0W12-|H,/1-2P5']|[%56>j?)! |[f!C"#01_a*L "Y#{*L k*L  }`m$Commands[Prog.Asst.Command]Similartoexceptsets(page9.11)sothatanyerrorsthatoccurwhileexecutingwillcausebreaks.[Prog.Asst.Command]Substitutesforin,andredoestheresult.Substitutionisdoneby(page17.57),andiscarriedoutasdescribedbelow.andcanincludenon-atomicmembers.Forexample,willsubstituteforeveryoccurrenceofintheprevioustwoevents,andsubstituteforeveryoccurrenceof,andreexecutethem.Notethatthesesubstitutionsdonotchangetheinformationsavedabouttheseeventsonthehistorylist.Anyexpressiontobesubstitutedcanbeprecededbya,meaningthattheexpressionistobesubstitutedasa,e.g.,followedbywillproduce,andwillproduce.Ifisomitted,therstmemberofisusedfor.Forexample,isequivalentto.Theisinsertedtohandlecorrectlythecasewheretherstmemberofcouldbeinterpretedasaneventaddresscommand.[Prog.Asst.Command]Ifareomitted,andtheeventreferredtowasitselfacommand,theargumentsandexpressionsubstitutedintoarethesameasfortheindicatedcommand.Ineect,thiscommandisthusacontinuationofthepreviouscommand.Forexample,following,typingisequivalentto.Ifareomittedandtheeventreferredtowasacommand,substitutionisforthe``operator''inthatcommand.Forexamplefollowedbyisequivalentto.Ifisomitted,itisthesameasspecifying.[Prog.Asst.Command]Moregeneralformofcommand.Seedescriptionofthesubstitutionalgorithmbelow.Note:Thecommandisparsedbyasmallnitestateparsertodistinguishtheexpressionsandarguments.Forexample,willbeparsedcorrectly.Everycommandinvolvesthreepiecesofinformation:theexpressionstobesubstituted,theargumentstobesubstitutedfor,andaneventspecication,whichdenestheinputexpressioninwhichthesubstitutiontakesplace.Ifthecommandhasthesamenumberofexpressionsasarguments,thesubstitution8.8RETRYREDOHELPCLOCKUSEFORINESUBSTUSELOG(MINUSX)FORANTILOGXIN-2AND-1LOGANTILOG(MINUSX)X!segmentLIST(ABC)USE!(XYZ)FORBLIST(AXYZC)USE!NILFORBLIST(AC)INUSEPUTDFOR@UTDUSEPUTDFOR@UTDINF@UTDFUSEINUSEUSEUSEUSEUSEXFORYIN50USEZIN-1USEZFORYIN50notUSEARGLIST(FF)USECALLSIN-1USECALLSFORARGLISTIN-1ININ-1USEFORANDANDFORINUSEUSEUSEFORFORANDANDANDFORFORUSEUSEEventSpecEventSpecEXPRSARGSEventSpecEXPRSARGSEventSpecEXPRSARGSEventSpecARGSEventSpecARGSEXPRSEventSpecARGSARGSEventSpecEXPRS1ARGS1EXPRSNARGSNEventSpec|b'&ex\:;?9BZl!&M148)9<?]CRF XW'I)-U;?9BTD #h)0149K;@ HsR"&t*-/36,7> G(Pp"%* MG4LM #=& -6#7:C?BG(J &(J, 2569@?eCGI, #%$',:. 69=AFE{GG\4DW !#&+ -p0F28:=H>DfGB V!j#W *L+12??DA $'Z9?:?eO'3<`!#8(+?.39[:>7EG4:,.3 59 p!'N)-359 =>?BH&7op8!' (3)+/4e4j;?9B2@%T(1*.358<@G1c!, ' .14N6:O<>_@/x >$<)01o4c5} =a? AY-!&;;,- /)(#&}(,S1t37;Bn 'a $&h)>0<2B9G%$&/ ,E3"!y"(M)+ -i02 =4} 8pxe;?9BQ #`'.1Y 8S9@ Go ! ),YH#  #~% -/E 6]79 @C5  n 3 rI &F*&.04P :?xA&DEZLM/J#4DWmAEH94j 2=j1F/x&F-,0/15:69m@CwE&GH,-!f$&q)+{.{)(5x8'8m % "#j.16:GACD\"'9;<]  )2H%ao269b<@CwF x#!}pX`m$2x\:SuX!|"#U H:6TD%'+,.RBP^<`%G5u7-@AC7o^4j H*2N)( " + H< ] $( -:.0 4637U }`m$11THEPROGRAMMER'SASSISTANTprocedureisstraightforward.Forexample,meanssubstituteforandfor,andisequivalentto.However,thecommandalsopermitsdistributivesubstitutions,forsubstitutingseveralexpressionsforthesameargument.Forexample,meansrstsubstituteforthensubstitutefor(inanewcopyoftheexpression),thensubstitutefor.Theeectisthesameasthreeseparatecommands.Similarly,isequivalentto,followedby,followedby.alsocorrespondstothreesubstitions,therstwithforandfor,thesecondwithfor,andfor,andthethirdwithfor,andagainfor.However,isambiguousandwillcauseanerror.Essentially,thecommandoperatesbyproceedingfromlefttorighthandlingeach``''separately.Wheneverthenumberofexpressionsexceedsthenumberofexpressionsavailable,multipleexpressionsaregenerated.Thusmeanssubstituteforatthesametimeassubstitutingfor,theninanothercopyoftheindicatedexpression,substituteforandfor.Notethatthisisalsoequivalentto.[Prog.Asst.Command]Similartoexceptsubstitutesforthe(rst).Forexample,followedbyisequivalentto.Note:Inthefollowingdiscussion,isusedtorepresentthecharacter,sincethisishowisechoed.[Prog.Asst.Command]isaspecialformofthecommandforconvenientlyspecifyingsubstitutionsinlitatomsorstrings.Inaddition,ithasanumberofusefulpropertiesinconnectionwitheventsthatinvolveerrors(seebelow).Equivalentto,whichwilldoacharactersubstitutionofthecharactersinforthecharactersin.Forexample,iftheusertypes,hecanthentypetoperform.Notethatwouldperform.[Prog.Asst.Command][Prog.Asst.Command][Prog.Asst.Command][Prog.Asst.Command]Abbreviatedformsofthecommand:thesameas,whichchangesstos.doeseventlocationthesameasthecommand,i.e.,ifisnotspecied,searchesfor.However,unlike,canonlybeusedtospecifyonesubstitutionatatime.Afterndstheevent,itlookstoseeifanerrorwasinvolvedinthatevent,andiftheindicatedcharactersubstitutioncanbeperformedintheobjectoftheerrormessage,calledtheoender.Ifso,assumesthesubstitutionrefersExceptwhenoneoftheargumentsandoneoftheexpressionsarethesame,e.g.,,or.Thissituationisnoticedwhenparsingthecommand,andhandledcorrectly.8.9USEXYFORUVXUYVUSEXFORUANDYFORVUSEUSEABCFORXAXBXCXUSEUSEABCFORDANDXYZFORWUSEAFORDANDXFORWUSEBFORDANDYFORWUSECFORDANDZFORWUSEABCFORDANDXFORYADXYBDXYCDXYUSEABCFORDANDXYFORZUSEANDUSEUSEABCDFOREFAEBFCEDFUSEACFOREANDBDFORF...USEoperandEXPRP(FOO)...FIEFUMUSEFIEFUMFORFOO$$FORIN$USEcharacterUSE$$FOR$$INMOVD(FOOFOOSAVET)$FIEFORFOOINMOVDMOVD(FIEFIESAVET)USEFIEFORFOOMOVD(FIEFOOSAVET)$IN$TOIN$=IN$->IN$$FORIN$USEIN$USE$$$USEXYFORYXUSEXFORYANDYFORXVARSXYEventSpecXYEventSpecXYYXEventSpecYXEventSpecYXEventSpecYXEventSpecXYEventSpecYXEventSpecYy\3 C !}`m$|b'!= -x\: j~2m6 >?AEIZ  { C))/5;6=B X /a  @ 'm)+/e6 8WI C< P p '+-.1469 @C U ?ILb!*-1 Sw %/,05RX &?TBC P   an"&)*-1589=@AD'FxO >@ ]u F0F  \(1 %>C;?9BB$j! %l ,!.\09?<(.\9;I A=y :t Tu "Q%'_-l/59=p@#ADHs8 5;?9B4#4+ $k&U, 25 =T 2~ !&2',.e45Q78=?nCl 0S H#`'*a//3"5- 68<?BMC,-  #* ),.12 7:)(>!K#&}9:<?B*'$&;=@% "67";?9B!1;?9B;?9B;?9B@ #%)03P6I!"%< DpO"$/*-p78:BFG ]u!%&+'- 5!67;c@;CEJ  S""w$6'+4-/m17= ESG Nm 1%),"237 F  t/ <"%'\) 03L59I V # !#Z)*/3o8`:AD (}`m$x\:%L(*W,/a1<@|DH*Z'1#<$(G2X>mACwE&FWI j&*-U r',7;<>m@CwE&HS H5 $@%)J*.U7;<@AE&FRX !"&$'+X-.0b35m8:w=P !%)48<]?O iF#&(*8+/C04M57;MfK J]&")+-,.0835BADHuDHF 7'P*,[. 1e36p89=)C B${4kx? 0C36CwF=y_:tb5 Ro4#({Cx-!F$&Q'+\- .)()18EE&F'_ +3:9CwF%'/5"  !1 R R R)@(8<(A3 !'.@*>5 23,-+>9E" R!1 &  O &@:y?CEF8 $e1R23 4=$ } ``m$Commandstotheoender,performstheindicatedcharactersubstitutionintheoenderonly,andthensubstitutestheresultfortheoriginaloenderthroughouttheevent.Forexample,supposetheusertypescausingaerrormessage.Theusercannowtype,whichwillchangeto,butchangeor.Ifanerrordidoccurinthespeciedevent,theusercanalsoomitspecifyingtheobjectofthesubstitution,,inwhichcasetheoenderitselfisused.Thus,theusercouldhavecorrectedtheaboveexamplebysimplytyping.Sinceisusedforperformingthesubstitution(seepage17.57),canbeusedintorefertothecharactersin.Forexample,iftheusertypes,causingtheerror,hecanrequesttheletobeloadedfrom'sdirectorybysimplytyping.Thisisequivalenttoperformingontheevent,andthereforereplacesby.Notethatneverforanerror.Thus,iftheusertypescausingaerror,types,andtypes,willcomplainthatthereisnoerrorin.Inthiscase,theuserwouldhavetotype,or(whichwouldcauseasearchfor).Notealsothatoperateson,notonprograms.Iftheusertypes,andwithinthecalltogetsaerror,herepairthisby.willtype.[Prog.Asst.Command]Envokesthedefaultprogrameditor(Deditortheteletypeeditor)onacopyoftheinput(s)for.Whenevertheuserexitsvia,theresultisunreadandreexecutedexactlyaswith.isprovidedforthosecaseswhenthemodicationstotheinput(s)arenotsimplesubstitutionsofthetypethatcanbespeciedby.Forexample,ifthedefaulteditoristheteletypeeditor,then:Theusercanalsospecifytheeditcommand(s)to,bytypingfollowedbythecommand(s)aftertheeventspecication,e.g.,.Inthiscase,theeditorwillnottype,orwaitforanafterexecutingthecommands.Note:callstheeditoronthe``inputsequence''ofanevent,adjustingtheeditorsoitisinitiallyeditingtheexpressiontyped.However,theentireinputsequenceisbeingedited,soitispossibletogiveeditorcommandsthatexaminethisstructurefurther.Formoreinformationontheformatofanevent'sinput,seepage8.25.8.10(PRETTYDEFFOOFNS'FOOFOOOVARS)U.B.A.FOOOVARS$OOOFOOOVARSFOOVARSnotFOOFNSFOO$FOOVARSESUBST$LOAD(PRSTRUCPROP)FILENOTFOUNDPRSTRUCLISP$$(RPRSTRUC$)PRSTRUCPRSTRUC$searchesLOAD(PRSTRUCPROP)FILENOTFOUNDCLOSEALL()then$$LISPXCLOSEALL()$$INLOAD$PRSPRSPRS$inputFOO()FOOU.D.F.CONDDcannot$CONDLISPXCONDDNOTFOUNDINFOO()FIXOKREDOFIXUSE_(DEFINEQFOO(LAMBDA(X)(FIXSPELLSPELLINGS2X70]INCORRECTDEFININGFORMFOO_FIXEDIT*P(DEFINEQFOO(LAMBDA&&))*(LI2)*P(DEFINEQ(FOO&))*OK(FOO)_LISPX-FIX-(LI2)EDITOKFIXYXYEventSpecEventSpec|b'&ex\:   I!k'9 .0,2t7;1=@ GZ  EH #&5*h-28:o=dX4!9/3M9(?B R  nx!^%M)4+.25;>OB^GP M$%p(* 14C ;>hAGTOR  Wp- "%[&X)"/036/IM ')+T.'3A58:z<AsH}L 5"#-&L' .n0# GJa  IR$1sG\  Wmm"u&A'),?DE!"(39^<BDHsD  q-"|$',/a1BvCZBk_#(~?e  U&{N!#*=+.089<*@`BE1=  #-'C)169<9;?9B7op$ )-135;?nAjBEG5$%,/2*5w9:z<@BfG(4# #$+@1 TPO #R +-_/479= EG/x  M<\7!') +h0 4 5u7<AP  @  &,o-J/D4:~ F  O -%)&B(*.0j4n79@@BEG^ W{X T .Y$Y +,/3>9F;?ACRD  "$o(V+13F7 ;=O>@ EGF  *%*-1 8:=ACYEP g  =(o!}`m$XxZ@ X "(cHWI  qz"d{+x29P2FOR9 DMz "E!L~,7V9@Ja'& G\{+x0d ;PEE  Hs {%~x,'-4D& 4-5<?E&FBk %?e{x4yF={x, -2 <AE&<  q9 574#'1 /x,s Sh(+ 1i3* S)( ' % $7 " {? E  { T  (;3p #z<^ X$}`m$(xR OR%$9 H5< !"}`m$&THEPROGRAMMER'SASSISTANT[Prog.Asst.Command]Printsthespeciedeventsfromthehistorylist.Ifisomitted,printstheentirehistorylist,beginningwithmostrecentevents.Otherwiseprintsonlythoseeventsspeciedin(intheorderspecied).Forexample,,,etc.Foreacheventspecied,printstheeventnumber,theprompt,theinputline(s),andthevalue(s).Iftheeventinputwasap.a.commandthat``unread''someotherinputlines,thep.a.commandisprintedwithoutaprecedingprompt,toshowthattheyarenotstoredastheinput,andtheinputlinesareprintedwithprompts.Eventsareinitiallystoredonthehistorylistwiththeirvalueeldequaltothecharacter``bell''(control-G).Thefore,ifanoperationfailstocompleteforanyreason,e.g.,causesanerror,isaborted,etc.,willprintabellasits``value''.commandsarenotenteredonthehistorylist,andsodonotaectrelativeeventnumbers.Inotherwords,aneventspecicationoftypedfollowingacommandwillrefertotheeventimmediatelyprecedingthecommand.isimplementedviathefunction,page8.35,whichcanalsobecalleddirectlybytheuser.Printingisperformedviathefunction(page6.17),sothatifthevalueof=,eventswillbeprettyprinted.[Prog.Asst.Command]Undoesthesideeectsofthespeciedevents.Foreacheventundone,printsamessage:,etc.Ifnothingisundonebecausenothingwassaved,types.Ifnothingwasundonebecausetheevent(s)werealreadyundone,types.Ifisnotgiven,searchesbackforthelasteventthatcontainedsideeects,wasnotundone,anditselfwasnotancommand.Notethattheusercanundocommandsthemselvesbyspecifyingthecorrespondingeventaddress,e.g.,or.Inordertorestoreallpointerscorrectly,theusershouldeventsinthereverseorderfromwhichtheywereexecuted.Forexample,toundoallthesideeectsofthelastveevents,perform,.Undoingoutofordermayhaveunforseeneectsiftheoperationsare.Forexample,iftheuserperformed,followedby,andthenundoesthe,hewillalsohaveundonethe.Ifhethenundoesthe,hewillcausethetoreappear,byvirtueofrestoringtoitsstatebeforetheexecutionof.Formoredetails,seepage8.23.[Prog.Asst.Command]EachisapatternthatismatchedtoamessageprintedbyDWIMintheevent(s)speciedby.ThesideeectsofthecorrespondingDWIMcorrections,andonlythosesideeects,areundone.Forexample,ifDWIMprintedthemessage,thenorwouldundothecorrection.SomeportionsofthemessagesprintedbyDWIMarestrings,e.g.,themessageisprintedbyprintingandthen.Therefore,if8.11????????-1??10THRU15??????-1??????PRINTHISTORYSHOWPRIN2SYSPRETTYFLGTUNDOUNDORPLACAUNDONEREDOUNDONEUNDONOTHINGSAVEDUNDOALREADYUNDONEUNDOUNDOUNDOUNDO-7UNDOUNDOUNDOUNDOTHRU-5notUNDOFROM-5dependent(NCONC1FOOFIE)(NCONC1FOOFUM)(NCONC1FOOFIE)(NCONC1FOOFUM)(NCONC1FOOFUM)FIEFOO(NCONC1FOOFUM)UNDO:PRINTT[INFOO]->PRINTUNDO:PRINTTUNDO:PRINTFOOUNSAVEDFOO"UNSAVED"EventSpecEventSpecEventSpecEventSpecEventSpecEventSpecX1XNXiEventSpec|b'!= -x\:;?9BZ #'+^-2Z54<>EX"D$+.$1l5z:-BFWIU%P,/'15Z IU"#nR4G ),/$28$:f?AE[PN":#%)-=/03: < BFAORD!#*5+0\5Y6w<ACGMw#%C'+.T04Y79>AJG#(0*^,147C:>AEGI!' (*4/1{39<>DG?G\T2#h%V)*/5$7;2A-EBX!#T&+Q-@0 8<@uFA  #%(+ 39>>Z #%(78U;>BE3G<`q 9" $?',. 468F!:a#!N#'R35U61:f=> 7;?9B6q"u&(+J16\93<@p4j.&9<\> CID2!$o,f:;=0B=D1 $G',d5D. T"*03B5z7:O=@G,smD!'q*T-03S9}@DG**$+ 2l4h :=; F+)(&(/z&#  TI #[%(1X57b9>B[E$}  %_4 8"%'*r-t136D8;@~"$%')-04':?@C5 !1 m- #7Y8R>  H) ()z+m.0409/I   %h&\(^+.4m6-VB]D(@ zQ /03Y6;=A };Lx;?9B#&'-Z.05T:<@BhDb$&)+0H24 =B J[r!#(q*D "a',/>I&926:P< !%#%+0}27:>BD !u"')224@A H}(o}`m$ x\: ZC{X@WIDGSH*U, R&G\2DWB:p;GGA <1>-t <`>5:) 4~7 6E4j#:)//3c2(/6119)?.&,s5o* )(#$',&#-c$}E" {xw{!1 Ux)03@F (!%=;BIE" 1P@ "7(,L; HD4:>BHC D ',/- /8%9 }``m$x\: HZ689=WI'(l)7|.$;|;,w !"} H`m$VCommandstheusertypes,theDWIMcorrectionwillnotbefound.Heshouldinsteadtypeor(,seeRcommandineditor,page17.35).[Prog.Asst.Command]Savestheevent(s)(includingsideeects)speciedbyonthepropertylistof(undertheproperty).Forexample,.commandsareundoable.Eventssavedonalitatomcanberetrievedwiththeeventspecication.Forexample,,,etc.Commandsdenedbycanalsobetypedindirectlyasthoughtheywerebuilt-incommands,e.g.,isequivalentto.However,ifisthenameofavariable,itwouldbeevaluated,i.e.,wouldreturnthevalueof.Commandsdenedbycanalsobedenedtotakearguments:[Prog.Asst.Command][Prog.Asst.Command]Theargumentsareinterpretedthesameastheargumentsforacommand.Whenisinvoked,theargumentvaluesaresubstitutedforusingthesamesubstitutionalgorithmasfor.isequivalentto.Ineithercase,ifisinvokedarguments,anerrorisgenerated.Forexample,followingtheevent,theusertypes.Thentypingwouldcausetobeexecuted,i.e.,wouldbeequivalenttotyping.Typingwouldcausetwo'stobeexecuted.Notethat'sand'scanalsobeemployedthesameaswith.Forexample,iffollowingtheuserperformed,thenwouldperformtheindicatedtwooperationswithreplacedby.[Prog.Asst.Command]Retrievesandreentersonthehistorylisttheeventsnamedby.Causesanerrorifwasnotnamedbyacommand.Forexample,iftheuserperforms,andatsometimelatertypes,6eventswillberecordedonthehistorylist(whetherornotthecorrespondingeventshavebeenforgottenyet).Notethatdoesreexecutetheevents,itsimplyretrievesthem.Theusercanthen,,,etc.anyoralloftheseevents.Notethattheusercancombinetheeectsofaandasubsequenthistorycommandinasingleoperation,e.g.,isequivalentto,followedbyanappropriate.Actually,isbetterthanfollowedbysinceinthelattercase,thecorrespondingeventswouldbeenteredonthehistorylist,oncefortheandonceforthe.Notethatandarepermitted.8.12UNDO:UNSAVEDUNDO:FOOUNDO:$UNSAVED$UNSAVEDNAMEHISTORYNAMEFOO10THRU15NAME@??@FOOREDO@FOONAMEFOOcrREDO@FOOFOOFOOcrFOONAMENAME():NAME:USEUSENAMEFOONAMEFOO:FOOwith(PUTD'FOO(COPY(GETPROP'FIE'EXPR)))NAMEMOVEFOOFIE:PUTDMOVETEST1TEST2(PUTD'TEST1(COPY(GETPROP'TEST2'EXPR)))USETEST1TEST2FORFOOFIEINMOVEMOVEABCDPUTD!$USE_PREPINDEX(14LISP.XGP)_FIXFILE(14LISP.XGPIDX)NAMEFOO$14$:-2AND-1FOO$15$1415RETRIEVENAMENAMEFOO10THRU15RETRIEVEFOOnewRETRIEVEnotREDOUNDOFIXRETRIEVEREDOFOORETRIEVEFOOREDOREDOFOORETRIEVEREDOtwiceRETRIEVEREDOUNDOFOO??FOOLITATOMEventSpecEventSpecLITATOMLITATOMLITATOMARG1ARGNEventSpecLITATOMARG1ARGNEventSpecARGiLITATOMARG1ARGNEventSpecEventSpecLITATOMLITATOMLITATOM|b'&ex\:(,-/4 ;t>4@BGZ ,C^FG#*,H 2==D HsE &b'+- 4z;d?CF7DWAQ -v!@#/(), }>L^x;?9B}<#x;?9B;Y$3&a -J/24f6=&?>C+9[!"(f*047 =}CDbDx7M!$ (.0y5:4%!& -o=?"AEH}3 $O +O->02 0  8?@C<FL._b#n6;!,#%('-/35r <=+/47>6?AC)n  _aL$';*,a125;N<!  4*+59?AZG3  ^;?9Bm %'*p/1k380<DQEE$Y')u-/4   }/o0g3248;> q <6S!G#(*;/146N ?+CPFw r!.&-/425:?CF  U!6#%&*Y/;257;=C<E+  " <#*6+-1 7AC5   +},v9;L?_ y #&O /D379>@C G : "]"$*+W.8@C@ (o!}`m$\x\: %&Z#().q24S?U R+;@CwEP\MALM "$N'+-IH&2G&zH )S)xG48:}EjE7zFf9:OxDW^AQ >L qa!< j;@D724/:3n63 {!Vx0$(B-L49._ S ( ,S1^?DDO, hAE&+ S $)*,y.(:)n+/y&i $ !N!#/$%)).1 X 1x#')-B {_xw{$qx>+ :|> G( 2h6B { : xx'&15;m=}`m$dxU qTD89x:RfOMCEyF8>L H=>L=x>L"$"%E< q)<=<<=@Ac M! "}`m$THEPROGRAMMER'SASSISTANT[Prog.Asst.Command]Undoestheeectsoftheeventsnamedby.[Prog.Asst.Command]Undoesa.andprovideaconvenientwayofippingbackandforthbetweentwostates,namelythestateaspeciedeventoreventswereexecuted,andthatstateexecution.Forexample,iftheuserhasacomplexdatastructurewhichhewantstobeabletointerrogatebeforeandaftercertainmodications,hecanexecutethemodications,namethecorrespondingeventswiththecommand,andthencanturnthesemodicationsoandonviaorcommands.Bothandareno-opsifthewasalreadyinthecorrespondingstate;bothgenerateerrorsifwasnotnamedbyacommand.Thealternativetoandforrepeatedswitchingbackandforthinvolvestyping,ofthe,ofthatetc.Ateachstage,theuserwouldhavetolocatethecorrecteventtoundo,andfurthermorewouldruntheriskofthateventbeing``forgotten''ifhedidnotswitchatleastoncepertime-slice.Note:Since,,,,andarerecordedasinputstheycanbereferencedby,,etc.inthenormalway.However,theusermustagainrememberthatthecontextinwhichthecommandisreexecutedisdierentthantheoriginalcontext.Forexample,iftheusertypes,thentypes,theinputthatwillberereadwillbeaswasintended,butbothand,willrefertothemostrecenteventcontainingthoseatoms,namelytheeventconsistingof.[Prog.Asst.Command]Recordstheeventsspeciedbyonapermanenthistorylist.Thishistorylistcanbereferencedbyprecedingastandardeventspecicationwith.Forexample,printsthearchivedhistorylist,willrecoverthecorrespondingeventfromthearchivedhistorylistandredoit,etc.Theusercanalsoprovideforautomaticarchivingofselectedeventsbyappropriatelydening,orbyputtingtheproperty,value,ontheevent.Eventsthatarereferencedbyhistorycommandsareautomaticallymarkedforarchivinginthisfashion(Seepage8.19).[Prog.Asst.Command]Permanentlyerasestherecordofthesideeectsfortheeventsspeciedby.Ifisomitted,forgetssideeectsforentirehistorylist.isprovidedforuserswithspaceproblems.Forexample,iftheuserhasjustperformeds,s,s,,s,etc.toreleasestorage,theoldpointerswouldnotbegarbagecollecteduntilthecorrespondingeventsagesucientlytodropotheendofthehistorylistandbeforgotten.canbeusedtoforceimmediateforgetting(oftheside-eectsonly).isnotundoable(obviously).[Prog.Asst.Command]Instructsthelepackageto``remember''theeventsspeciedby.Theseeventswillbemarkedaschangedobjectsoflepackagetype,which8.13BEFOREAFTERBEFOREBEFOREAFTERbeforeafterNAMEBEFOREAFTERBEFOREAFTERNAMEBEFOREAFTERUNDOUNDOUNDOUNDOUNDONAMERETRIEVEBEFOREAFTERREDOUSENAMEFOODEFINEQTHRUCOMPILE...FIENAMEFIEDEFINEQTHRUCOMPILEDEFINEQCOMPILENAMEFOODEFINEQTHRUCOMPILEARCHIVE@@??@@REDO@@-1ARCHIVEFN*ARCHIVE*TFORGETFORGETSETRPLACARPLACDPUTDREMPROPFORGETFORGETREMEMBEREXPRESSIONSLITATOMLITATOMLITATOMLITATOMLITATOMLITATOMEventSpecEventSpecEventSpecEventSpecEventSpecEventSpecEventSpec|b'!= -x\:;?9BZ#J%'_+07W;?9BU)4REj $').2'48>@EQ>  KU$'T-f029L @BH}O  X^!}%'+-</:2@3 :?OBEZM 8 &*, 59=C*LM  cm !m#&K(W006>1G(J2{!3%') 2679Z>BI  E  K^!#)J/D2s58o=E5DW  uH "&);,=0s35|9{;@~D;EB  GmT!$r(+ 3)46n8;J?{AD+GjA  >   l&>'.I06(7;>ADC <` cJ $#*:,/3X7 =@C?H0:  ye X &s),1369{?_@CBFL9"I#&$/0N26.8;~=[AD 7o }#A)r, 5>?BNEG5  ^` ,$U)<+/| 54#1;?9B/xT#)'024:?|B:EP- %'.(/r5)8 @EG4,-"&);.3?BvG* $F'*/46Z9<<='S "!&)/956;?Ar %$%').1B>?DKEQG$7 #[% ,.3": ?BDG>!'.$39;b>o@9DW!%(*/47:P C4G`J  W#%(U+,/U36C9 ; GT"|)\ /247^;EGj ;?9B SH"'X) 13w7=fDE ; $&d+0138EE(o"}`m$x\: W UR n{Q>{6xM?WLM*1AJ IEAEDW\>k!3)<` a9 {4h),E7o  H4/a857;?DE4# 1 -D,- 36:=;>%$7Ct ;")/3JA@.  ; !}P`m$x\:vZ234WU#%&jJjCEF1#/x+,{-*LCEF8@' { S?k@A"} l`m$nCommandscanbewrittenoutviathelepackagecommand.Forexample,aftertheusertypes:Iftheusercalls,,or,thecommandwillbeconstructedbythelepackageandaddedtothelecomsindicatedbytheuser,unlesstheuserhasalreadyexplicitlyaddedthecorrespondingexpressiontosomecommandhimself.Notethat``remembering''aneventlikewillresultinacommand,becausethiswillsavethecurrent(atthetimeofthe)valuefortheproperty,whichmayormaynotbe.Thus,evenifthereisacommandwhichsavesthepropertyforinsome,rememberingthiseventwillstillrequireacommandtoappear.[Prog.Asst.Command]``PrintPropertyList.''Printsoutthepropertylistofinaniceformat,withresetto.Forexample,isimplementedviathefunction.[Prog.Asst.Command]``PrintBindings.''Printsthevalueofwithresetto.Ifisnotbound,doesnotattemptspellingcorrectionorgenerateanerror.isimplementedviathefunction.isalsoabreakcommand(page9.5).Asabreakcommand,itascendsthestackand,foreachframeinwhichisbound,printstheframenameandvalueof.Iftypedintotheprogrammer'sassistantwhennotatthetoplevel,e.g.intheeditor,alower,etc.,willalsoascendthestackasitdoeswithabreak.However,asaprogrammer'sassistantcommand,itisprimarilyusedtoexaminethetoplevelvalueofavariablethatmayormaynotbebound,ortoexamineavariablewhosevalueisalargelist.[Prog.Asst.Command]Allowstheusertotypealineoftextwithouthavingtheprogrammer'sassistantprocessit.Usefulwhenlinkedtootherusers,ortoannotateadribblele(page6.12).[Prog.Asst.Command]Allowstheusertoevaluateanexpressionwithouthavingtheprogrammer'sassistant8.14P_MOVD?(DELFILE/DELFILE)DELFILE_REMEMBER-1(MOVD?(QUOTEDELFILE)(QUOTE/DELFILE))_FILES?MAKEFILESCLEANUP(P(MOVD?(QUOTEDELFILE)(QUOTE/DELFILE)))P(PUTPROP'FOO'CLISPTYPE)not(PROPCLISPTYPEFOO)MAKEFILECLISPTYPEPROPCLISPTYPEFOOCOMS(P(PUTPROP'FOO'CLISPTYPE))PLPRINTLEVEL(2.3)_PL+CLISPTYPE:12ACCESSFNS:(PLUSIPLUSFPLUS)PLPRINTPROPSPBPRINTLEVEL(2.3)PBPRINTBINDINGSPBUSEREXECPB;SHHEXPRESSIONEXPRESSIONFILEEXPRESSIONLITATOMLITATOMLITATOMLITATOMLITATOMLITATOMLITATOMFORMFORM|b'&ex\:HQ!#%(p*017|8q;3ADpFZM9&/\0I78;\LM5)8@: BYDGJ# $x&e).469=8AD4GjIb "2&?( 1e 89>dDE'*(,sDW "5K7\CF?e])/5 6@AsEG=+ Q"#'<$!9;?9B7o!%),/47>@BE5#&.{/2+,sC #%(%6)n;?9B' "&)S-4@DB&#Tc!#K%*s-05":5 @BmG$}5 '),CF! ;?9B T!-"') 0c5M9; D(o!}`m$x\:6W $AUTD R#j*0 PM!'2ADOLM%* I=E.6: K{DWlx#(1NB+J;A ??e!1='=(+26 G9 5 (+,21 !/x !&+,s- )n '7 EH&#$}1 !x'1  }p`m$xEC A (, ?e:n=@ 9 q[7o8:;)n q['.01u&#)+,O,oX Y H }$\`m$\THEPROGRAMMER'SASSISTANTprocessitorrecorditonahistorylist.Usefulwhenonewantstobypassaprogrammer'sassistantcommandortokeeptheevaluationothehistorylist.[Prog.Asst.Command](Interlisp-10)Calls(page22.21)todescendtolowerexec.Ratherthanstartupanewforkeachtimetheusertypes,thecommandwillsavetheoldforkhandleuponreturnfromancommand,and,iftheforkhandleisstillactive,reuseitforthenextcommand,i.e.anfollowedbyanotherisequivalenttoanfollowedbya.[Prog.Asst.Command](Interlisp-10)Performstocontinuethelastcallto(page22.21).[Prog.Asst.Command]Acommandthatallowstheusertotype-aheadanindenitenumberofinputs.Theassistantrespondstowithapromptcharacterof.Theusercannowtypeinanindenitenumberoflinesofinput,underprotection.Theinputlinesaresavedandunreadwhentheuserexitsthetype-aheadloopwiththecommand().Whileinthetype-aheadloop,canbeusedtoprintthetype-ahead,toeditthetype-ahead,and()toerasethelastinput(maybeusedrepeatedly).Thecommandmaybeabortedby();control-Esimplyabortsthecurrentlineofinput.Forexample:8.15EXECSUBSYSEXECEXECEXECEXECEXECEXECEXECCONTINCONTIN(SUBSYST)SUBSYSTYPE-AHEADTYPE-AHEAD>ERRORSET$GOGO??FIX$QQTYPE-AHEAD$STOPSTOP_TYPE-AHEAD>SYSOUT(TEM)>MAKEFILE(EDIT)>BRECOMPILE((EDITWEDIT))>F>$Q\\F>$Q\\BRECOMPILE>LOAD(WEDITPROP)>BRECOMPILE((EDITWEDIT))>F>MAKEFILE(BREAK)>LISTFILES(EDITBREAK)>SYSOUT(CURRENT)>LOGOUT]>??>SYSOUT(TEM)>MAKEFILE(EDIT)>LOAD(WEDITPROP)>BRECOMPILE((EDITWEDIT))>F>MAKEFILE(BREAK)>LISTFILES(EDITBREAK)>SYSOUT(CURRENT)|b'!= -x\:L P$&r(*!.2q7;=BDHZ ]%,-/250 ;=@DDW;?9BU (,02^79H=R"$%'*-035<=}CQ><+u!$),049@RCPDFO0 F$(1)+.25,;>aD>M"# *,F279?J;?9BIH  /%069D;>F!GD;?9BB1"X&(+-046q<ACi?  jQ#3&q',2569=?BFG>L ?A +Z 25_9B{E9<  {!$&/6Y7;=I?BFc; \ >&'*,/4O9B>?A|DG_9[  ! )z/249@_Hg7 e"\$4  (o!}`m$xW U#SR9a?Q>5O1E@WM.5:J IH&,@kD ?#W4>L$<-0x; #7 99[ $;@1 0 ._ ,  + )n ' &# $} " !1    @ ]  O  ^ 4? l  !!}`m$CommandsNotethattype-aheadcanbeaddressedtothecompiler,sinceitusesforinput.Type-aheadcanalsobedirectedtotheeditor,buttype-aheadtotheeditorandtocannotbeintermixed.Thefollowingaresomeusefulfunctionsandvariables:[NLambdaNoSpreadFunction]Annlambdafunctionforobtainingthevalueofaparticularevent,e.g.,,.Thevalueofaneventconsistingofseveraloperationsisalistofthevaluesforeachoftheindividualoperations.Note:Thevalueeldofahistoryentryisinitializedtobell(control-G).Thusavalueofbellindicatesthatthecorrespondingoperationdidnotcomplete,i.e.,wasabortedorcausedanerror(orelseitreturnedbell).Note:Althoughtheinputforisenteredonthehistorylistbeforeiscalled,stillreferstothevalueoftheexpressionimmediatelybeforetheinput,becauseeectivelybacksthehistorylistuponeentrywhenitretrievesthespeciedevent.Similarly,willndthersteventbeforethisonethatcontainsa.[Variable]Thevalueofthevariableisalwaysthevalueofthelasteventexecuted,i.e..Forexample,Ifthelasteventwasamultipleevent,e.g.,issettovalueofthelastoftheseevents.Followingacommand,issettovalueofthelasteventprinted.Inotherwords,inallcases,issettothelastvalueprintedontheterminal.control-UWhentypedinatanypointduringaninputbeingreadby,permitstheusertoedittheinputbeforeitisreturnedtothecallingfunction.Note:control-NforInterlisponTOPS-20.Thisfeatureisusefulforcorrectingmistakesnoticedintypingtheinputisexecuted,insteadofwaitingtillafterexecutionandthenperformingananda.Forexample,iftheusertypes8.16>LOGOUT]>FIXEDIT*(RBRECOMPILEBCOMPL)*P((LOGOUT)(SYSOUT&)(LISTFILES&)(MAKEFILE&)(F)(BCOMPL&)(LOAD&)(MAKEFILE&)(SYSOUT&))*(DELETELOAD)*OK>$GOLISPXREADLISPX(VALUEOF)(VALUEOF-1)(VALUEOF_FOO-2)VALUEOFVALUEOF(VALUEOF-1)VALUEOFVALUEOF(VALUEOFFOO)FOOITIT(VALUEOF-1)_(SQRT2)1.414214_(SQRTIT)1.189207REDO-3THRU-1IT??ITITLISPXREADbeforeUNDOFIXLINE|b'&exJn  a/12"#&,/0;>3BdEH  t>-v#!U$W(V*,`0^39w=? E  "%r B6*=CA$'-/b245 ;??s,)-*&,0L137# =G>C5 =9u, $&*+.2 4 :"W%'K(-%02E 8:e=,BHCE'H9"J%Z(#*~ 3j9;>lDG47|o"$(E*-4.44w%"%/) 2T49B;>6C E2G/W206=8%:>@C+ 1+ $- 14< CG/A ;"&G)+028X< -/!#c&#).03h63;??*C )5b 9"*Z+0e268:=AlG'!"%l v!$:%\*.>AB}DF7S#B'.f1:<>!?C`E G_Hj "&*,.46T8:@<?>BG !^#%)S-/3y7L:oDD!g#'k+- .v4 581}5686/8H2s E5GP /"'N(-/159g:=E@<CiIOY  C Sd"6$(8*6,139:?AHM  Ea9 %'*-1p67~9=@ CYJ ]Z%)H-/14|FI ivtd #(xA OO"=' .2 76:;>@CH0@?  O0 $&X*}02{49&<>A5F>  w  o$, -/70l47>p Ee<  3yi#' )/03e6eG(;N Ar `#%z*-+0?-@BG49 QR !\#%Z'+} 2*4#47C{G8  l#$'d .0Z29=B~D4F+6\ `B ' 06=*>AG4  T> !i'+3-,138B9<?cC3  C3"$().S46 <>JABE1k bZ!&(Y*-C CF/  X3k"$f&*u.4z5U7<@,  0!# ,2x98?CoH  +^  #P)1/36t:<? C[G H:&\w"%'v+(/29<?@F6G  FQ.#V +/1=3@59;>?F+   % A! "#(o.368>B7Cw  U "D$m&+-04e6@9#>AGP   /"0$'*2W5-;2@C(FL6t7Q:=@?Bk 4C"^#R%(-/_!#%b ,/F4h6%8s=BtF   px e '3,-0389@ADh   C*a!A'*.026m:=?CiE n   l#,%~*C+/15;=1 DEeH&(o} `m$x\A +@(WO%TJ'z/ 2f9<{DH*R2qPE{OY=xJOA383<:=\? @BgE;NYc2579K:>V9 3L8!6N:?l{3:x1k1f48;{>A]B4/h1>q)u'e*.1{83;BHE'x* .@67&)%7(+/MCF}$)~{1x<"9b<@Cw!8  H]"u8V&   H$(+,^./1i45E I69b<@F_ ]h @RA) y)*GH L,-!} `m$TChangingTheProgrammer'sAssistantthecurrenthistory,nottheoriginalcontext''doesnotapplyifthecorrectionisperformedimmediately.8.3CHANGINGTHEPROGRAMMER'SASSISTANT[Function]Changesthetime-sliceofthehistorylistto(seepage8.25).Ifis,changesboththetoplevelhistorylistandtheedithistorylist.Note:Theeectofthetime-sliceisgradual:thehistorylistissimplyallowedtogrowtothecorrespondinglengthbeforeanyeventsareforgotten.thetime-slicewillimmediatelyremoveasucientnumberoftheoldereventstobringthehistorylistdowntothepropersize.However,isundoable,sothattheseeventsare(temporarily)recoverable.Therefore,iftheuserwantstorecoverthestorageassociatedwiththeseeventswithoutwaitingmoreeventsuntiltheeventdropsothehistorylist,hemustperformacommand(page8.13).[Variable]Whenthisvariableissetto,thecurrenteventnumbertobeprintedbeforeeachpromptcharacter.See,page8.31.isinitially.[Variable]Thevalueofisalistofexpressionwhichareevaluatedeachtime(page8.31)iscalledtoprintthepromptcharacter.Ifisgoingtoprintsomething,itrstmapsdownevaluatingeachexpressionunderan.Theseexpressionscanaccessthespecialvariables(thecurrenthistorylist),(thepromptcharactertobeprinted),and,whichiswhatwillprintbefore,ifanything.Whenis,willbetheeventnumber.Theexpressionsoncanchangetheshapeofacursor,updateaclock,checkformail,etc.orchangewhatisabouttoprintbyresettingand/or.Aftertheexpressionsonhavebeenevaluated,isprintedifitis(still)non-,andthenisprinted,ifitis(still)non-.[Variable]Thevalueofisalistofexpressionsthatareevaluatedundererrorsetprotectioneachtime(page8.32)createsanewevent.Thishappenseachtimethereisaninteractionwiththeuser,butnotwhenperforminganoperationthatisbeingredone.Theexpressionsonarepresumablyexecutedforeect,andcanaccessthespecialvariables(thecurrenthistorylist),(thecurrentpromptcharacter),and(thecurrenteventwhichisgoingtoreturn).Notethatandtogetherenablebracketingeachinteraction8.18(CHANGESLICE)NILLISPXHISTORYEDITHISTORYincreasingDecreasingCHANGESLICECHANGESLICEFORGETPROMPT#FLGTPROMPTCHARPROMPT#FLGTPROMPTCHARFORMSPROMPTCHARFORMSPROMPTCHARPROMPTCHARPROMPTCHARFORMSERRORSETHISTORYIDPROMPTSTRPROMPTCHARIDPROMPT#FLGTPROMPTSTRPROMPTCHARFORMSPROMPTCHARIDPROMPTSTRPROMPTCHARFORMSPROMPTSTRNILIDNILHISTORYSAVEFORMSHISTORYSAVEFORMSHISTORYSAVEHISTORYSAVEFORMSHISTORYIDEVENTHISTORYSAVEPROMPTCHARFORMSHISTORYSAVEFORMSNHISTORY_HISTORYNHISTORYN|b'$4' /x\:  Ie%G(t*.02k 8:GA |U iN 'xPC5 O  m"%'()u-58;>BMfS!k$&)F,y0=@QBEPK# H"v*-10H3l4:<ACEqG"$'L 059<@C Ep #&) 1f6C7c=(BHCFMCR # ')-_.1358HsB$"{%*(,r 4 < C8DF@P"9$)d /36:?FM>+'.247 ;> @ ChH=35#'L:.C 8J#t$&)f*:,1M4:;=BlF6 "-.2 >d?E3C 27./1F35 <AC0']+C.0c46V9?BF G#m&(f*Y 114M6:<>B "#'v !13 ;<@C#G(q), $138=BHE #s+ -26DF &S !  .4J8 ?C (o"}D`m$LxP Mf3# K {H$E Ep xC> >!k =3:. 8(6% 5y D3 27 0I . <-F.*A6(8& ,= H*%P<" 5; ^ ;r"+M> h)[ #q*@&>: !} "}D`m$xPO 047vDH@D"}`m$&THEPROGRAMMER'SASSISTANTwiththeuser.Thesecanbeusedtomeasurehowlongtheusertakestorespond,touseadierentreadtableorterminaltable,etc.[Variable]Thevalueofisalistofformsthatareevaluatedateach,i.e.whenusertypescontrol-D,callsfunction,ortypescontrol-Cfollowedby.[Variable]Iftheofis,andaneventisabouttodropotheendofthehistorylistandbeforgotten,iscalledasafunctionwithtwoarguments:theinputportionoftheevent,andtheentireevent(seepage8.25fortheformatofevents).Ifreturns,theeventisarchivedonapermanenthistorylist(seepage8.13).Notethatmustbesetanddened.isinitiallyandundened.Forexample,deningaswillkeeparecordofallcallsto.[Variable]Ifthevalueofisnon-,thesystemautomaticallymarksalleventsthatarereferencedbyhistorycommandssothattheywillbearchivedwhentheydropothehistorylist.isinitially,soonceaneventisredone,itisguaranteedtobesaved.Aneventis``markedforarchiving''byputtingtheproperty,value,ontheevent(seepage8.25).Theusercoulddothisbymeansofanappropriatelydened(seebelow).[Variable]providesamacrofacilitythatallowstheusertodenehisownprogrammer'sassistantcommands.Itisalistofelementsoftheform.Wheneverappearsastherstexpressiononalineinainput,thevariableisboundtotherestoftheline,theeventisrecordedonthehistorylist,isevaluated,and'svalueisstoredasthevalueoftheevent.Similarly,wheneverappearsasofaforminainput,thevariableisboundtooftheform,theeventisrecorded,andisevaluated.Anelementoftheformisinterpretedtomeanbindandevaluateasdescribedabove,exceptdosavetheeventonthehistorylist.[Variable]allowstheusertodeneprogrammer'sassistantcom-mandsthatre-executeotherevents.isinterpretedthesameas,exceptthattheresultofevaluatingistreatedasalistofexpressionstobe,exactlyasthoughtheexpressionshadbeenretrievedbyacommand,orcomputedbyacommand.Notethatreturningmeansnothingelseisdone.Thisprovidesamechanismfordeningcommandswhichareexecutedforeectonly.8.19RESETFORMSRESETFORMSRESETRESETSTARTARCHIVEFNvalueARCHIVEFNTARCHIVEFNARCHIVEFNTARCHIVEFNbothARCHIVEFNNILARCHIVEFN(LAMBDA(XY)(EQ(CARX)'LOAD))LOADARCHIVEFLGARCHIVEFLGNILARCHIVEFLGT*ARCHIVE*TLISPXUSERFNLISPXMACROSLISPXMACROS()LISPXLISPXLINECARLISPXLISPXLINECDR(NIL)LISPXLINEnotLISPXHISTORYMACROSLISPXHISTORYMACROSLISPXHISTORYMACROSLISPXMACROSunreadREDOUSENILLISPXCOMMANDDEFCOMMANDDEFDEFCOMMANDDEFCOMMANDDEFDEFDEF|b'!= -x\:  +u!'O*x-0;3Y68>@iCDSZ WC Uq ()+-F.257=?|FGTDiq"&(+568[;@B2GROC MKy)+,/157D;G=@BELH&LM7!g$O&r 5>6;<>@CG3J !%|*,f.3068<@CFI!"(2`89;?V@FHG\#T%(,0H3>BGE[')C1F3B#x,A O#$&).>C <`\)h*0037w ?CE:{ #%*71258;=CF9b#/0679[<>B4CH7o !#4j$& -/x486CDI2"m%),^/O3579=?Ar 1&N).C ,s!'?(,14z8;N>k@>DF* X%-./13G4:<^>)().0Z25 Q?B?C',T-2479;>ADHs%"A&,.p 5#:i;?A\EG$7O h# )6<@BtCGH"` a"0 1v5:B`DHs #T$ B!$i79O @BF@"+,3#7<@CF+ C '(+.v1379<@AC`FcJ2) %)>@IArC G%&(+ -0359>@QDFGh0 "a(R);*-/4O68 :~=@DXM!&D(=*.1 58)=-@CG !$&(R,d/56L=? $"$&5*,0(o},`m$xW U BTD1fRO {Mx!U+LM,I*+70G\6{DxE.=B$.[57:={AD3A +q> <` -~9& 54jx J. {$Z%xX62k E& },h`m$x*B)("%)8$70 j(3@(<"}4`m$0ChangingTheProgrammer'sAssistantManyprogrammer'sassistantcommands,suchas,,,etc.areimplementedthroughor.Note:Denitionsofcommandsonorcanbesavedonleswiththelepackagecommand(seepage11.24).[Variable]Whenissetto,itisappliedasafunctiontoallinputsnotrecognizedasaprogrammer'sassistantcommand,oronor.Ifdecidestohandlethisinput,itsimplyprocessesit(theeventwasalreadystoredonthehistorylistbeforewascalled),setstothevaluefortheevent,andreturns.Theprogrammer'sassistantwillthenknownottocallor,andwillsimplystoreintothevalueslotfortheevent,andprintit.Ifreturns,oriscalledintheusualway.Notethatmustbebothsetanddened.isgiventwoarguments:and.istherstexpressiontyped,andistherestoftheline,asreadby(page8.30).Forexample,iftheusertyped,=,and=;iftheusertyped,=,and=;andiftheusertyped,=and=.Byappropriatelydening(andsetting),theusercanwithaminimumofeortincorporatethefeaturesoftheprogrammer'sassistantintohisownexecutive(actuallyitistheotherwayaround).Forexample,couldbedenedtoparseallinput(otherthanp.a.commands)inanalternativeway.Notethatsinceiscalledforeachinput(exceptforp.a.commands),itcanalsobeusedtomonitorsomeconditionorgatherstatistics.[Function][Function][Function][Function][Function][Function][Function]Inadditiontosavinginputsandvalues,theprogrammer'sassistantsavesmostsystemmessagesonthehistorylist.Forexample,,,,outputof,,,DWIMmessages,etc.Whenprintstheevent,theoutputisalsoprinted.Thisfacilityisimplementedviathesefunctions.Thesefunctionsprintexactlythesameastheirnon-counterparts.Then,theyputtheoutputonthehistorylistundertheproperty(seepage8.25).Ifisnon-,thesefuctionsdonotprint,butonlyputtheiroutputonthehistorylist.Toperformoutputoperationsfromuserprogramssothattheoutputwillappearonthehistorylist,theprogramneedssimplytocallthecorresponding8.20RETRIEVEBEFOREAFTERLISPXMACROSLISPXHISTORYMACROSLISPXMACROSLISPXHISTORYMACROSLISPXMACROSLISPXUSERFNLISPXUSERFNTLISPXMACROSLISPXHISTORYMACROSLISPXUSERFNLISPXUSERFNLISPXVALUETEVALAPPLYLISPXVALUELISPXUSERFNNILEVALAPPLYLISPXUSERFNLISPXUSERFNREADLINEFOO(ABC)FOO((ABC))(FOOABC)(FOOABC)NILFOOABCFOO(ABC)LISPXUSERFNLISPXUSERFNLISPXUSERFN(LISPXPRINT)(LISPXPRIN1)(LISPXPRIN2)(LISPXSPACES)(LISPXTERPRI)(LISPXTAB)(LISPXPRINTDEF)FILECREATED(REDEFINED)(RESET)TIMEBREAKDOWNSTORAGE??LISPX*LISPXPRINT*NILLISPXXLINEXLINEXLINEXLINEXLINEXYZNODOFLGXYZNODOFLGXYZNODOFLGXYZNODOFLGXYZNODOFLGXYZNODOFLGEXPRFILELEFTDEFTAILNODOFLGFNVARNODOFLG|b'$4' /x\:  a#'/5:;?A Z )W  h3(:<>`BDFU  I#&*RC Q>&P($*-.02n79;eADCZEOK ![#9$ -|3 9;HM&'279,=@4D)EqLM!%W',025"9;J+-v0 36`8=G@5EGI R%(D+]/1v39l?W@)BEqG\#&m(,9.0379<>E#s)+4/0369=[D  4"O%A !T"&H( 1=68:D?H@CF < "-Z.Z479;=U?B:t!'.7o* "(,R:<>B@E3H5# *-;2o436 ?`DG4# &@')+g/17:K2~"{$:')-148?jA)C* 0i"s0 158s;?DG@/2 V #3%'+%,25;=yA ,-C5 *C5 (C5 '# *s-07 8;>$BEZ gh!%#&,;0I469z< (o!}`m$fx\:(06Z W$ *U3 R Q>$ ,O>' M) LM@ J"l EI5;$G\ @ EI%*@ A  ?e1e= %',[6:;<6$(O)+5fF:tT(+j-7o1 4#@ 0& ,- * ( '< % # X"J /B9=GFY !%1h5>2$8Bc<\ # gE&}`m$xA /37?eM=*$2{<!1-:t$,-p*p(p'<G%G#S Yp"JN"[%&`)B.YGY!"&= }|`m$THEPROGRAMMER'SASSISTANTprintingfunction.[Function]Thefunctionisavailabletopermittheusertodeneadditionalprintingfunctions.Iftheuserhasafunctionthattakesthreeorfewerarguments,andthesecondargumentisthelename,hecandeneaprintingfunctionbysimplygivingthedenitionof,forexample,with.isdenedtolookbackonthestack,ndthenameofthecallingfunction,stripotheleading``'',performtheappropriatesavinginformation,andthencallthefunctiontodotheactualprinting.[Variable]If=,theprintingfunctionswillnotstoretheiroutputonthehistorylist.isinitially.8.4STATISTICSTheprogrammer'sassistantkeepsvariousstatisticsaboutsystemusage,e.g.,numberofuserinputs,numberofundosaves,numberofcallstoeditor,numberofeditcommands,numberofp.a.commands,cputime,consoletime,etc.Thesecanbeviewedviathefunction.Theusercandeneaddnewstatisticstothep.a.statisticsviathefunction,andincrementthemwith.Note:Thecollectionofprogrammer'sassistantstatisticsisnotsupportedinInterlisp-D.andaredenedwithnulldenitions,soprogramscanbetransferred.[Function]Printsprogrammer'sassistantstatistics.If=,returnsthestatisticsasalistofelementsoftheform.[NLambdaNoSpreadFunction]Eachisalistoftheform.Eachisdenedasthenameofanewstatistic.Forexample,willdenetwonewstatistics,namedand.[Function]Incrementsthestatisticwithnameby(or1if=).hasa(seepage12.14).Theusercansavehisstatisticsforloadingintoanewsystembyperforming.Aftertheleisloaded,thestatisticsprintedbywillbethesameasthosethatwouldbeprintedfollowingthe.8.21(USERLISPXPRINT)USERLISPXPRINTLISPXLISPXLISPXUSERLISPXPRINTMOVD(USERLISPXPRINTLISPX)USERLISPXPRINTLISPXLISPXPRINTFLGLISPXPRINTFLGNILLISPXLISPXPRINTFLGTLISPXSTATSADDSTATSLISPXWATCHADDSTATSLISPXWATCH(LISPXSTATS)T(.)(ADDSTATS)(.)(ADDSTATS(EDITCALLSCALLSTOEDITOR)(UNDOSTATSCHANGESUNDONE)EDITCALLSUNDOSTATS(LISPXWATCH)NILLISPXWATCHBLKLIBRARYDEFMAKEFILE(DUMPSTATS)DUMPSTATSLISPXSTATSMAKEFILEXFILEZNODOFLGFNFNFNRETURNVALUESFLGRETURNVALUESFLGVALUEEXPLANATIONSTAT1STATNSTATiSTAT-NAMEMESSAGESTAT-NAMESTATNSTATNN|b'!= -x\:Y5C5 Wa+-724d8:=?gCl Uc! (3),/12:r=C@DNFTD !$e)(/1!36::<?sCR"H$:(35g;IP:HsORP!r$&):-/2Z6"7:M>DGM #%+ - 49G AEDGTLx!%#*%)IC G\#'(/X4r:F<?BOEoE .0/6|> i x:.   $ *N.l3$7:@+B#EZ8 \9`"$#((-O/18>%?B6  ?!Z#;'),N::=@CG(5=  6@ h #/.0 29/<H427    !& ,T-0D68v =G(0(& '(.1_3N -C5 + $* 1??/AfBG*A "#)+:-A}'<`x6*=C% v!#%(kACG #(o"}`m$xY5 $DW UTDE&R,=> P#%39< MI G\ %O*E#T 5)61 5=(u? 27?0 - )+@*A06@'< !%+4,;v !)l 27:9@ E_> : $- 9 D. @"}`m$xY5]E#\U89R0P8'-u@+38:|>G*A1248<='<Sv&N'<>a&9%"F%-%,e-./59@BXCDRf$,.-.2B8|}4t`m$22Undoing8.5UNDOINGNote:Thisdiscussiononlyappliestoundoingundertheexecutiveandbreak;theeditorshandlesundoingitselfinaslightlydierentfashion.Thecapabilityoftheprogrammer'sassistantisimplementedbyrequiringthateachoperationthatistobeundoableberesponsibleitselfforsavingonthehistorylistenoughinformationtoenablereversalofitssideeects.Inotherwords,theassistantdoesnot``know''whenitisabouttoperformadestructiveoperation,i.e.,itisnotconstantlycheckingoranticipating.Instead,itsimplyexecutesoperations,andanyundoablechangesthatoccurareautomaticallysavedonthehistorylistbytheresponsiblefunctions.Thecommand,whichinvolvesrecoveringthesavedinformationandperformingthecorrespondinginverses,worksthesameway,sothattheusercanan,andthatetc.Ateachpoint,untiltheuserspecicallyrequestsanoperationtobeundone,theassistantdoesnotknow,orcare,whetherinformationhasbeensavedtoenabletheundoing.Onlywhentheuserattemptstoundoanoperationdoestheassistantchecktoseewhetheranyinformationhasbeensaved.Ifnonehasbeensaved,andtheuserhasspecicallynamedtheeventhewantsundone,theassistanttypes.(Whentheusersimplytypes,theassistantsearchesforthelastundoableevent,ignoringeventsalreadyundoneaswellasoperationsthemselves.)Thisimplementationminimizestheoverheadforundoing.Onlythoseoperationswhichactuallymakechangesareaected,andtheoverheadissmall:twoorthreecellsofstorageforsavingtheinformation,andanextrafunctioncall.However,eventhissmallpricemaybetooexpensiveiftheoperationissucientlyprimitiveandrepetitive,i.e.,iftheextraoverheadmayseriouslydegradetheoverallperformanceoftheprogram.Hencenoteverydestructiveoperationinaprogramshouldnecessarilybeundoable;theprogrammermustbeallowedtodecideeachcaseindividually.Thereforeforeachprimitivedestructivefunction,Interlisphasdenedanundoableversionwhichalwayssavesinformation.Byconvention,thenameoftheundoableversionofafunctionisthefunctionname,preceededby``.''Forexample,thereisand,and,etc.The``slash''functionsthatarecurrentlyimplementedcanbefoundasthevalueof.Thevarioussystempackagesusetheappropriateundoablefunctions.Forexample,usesandsoastobeundoable,andDWIMusesand,whenitmakesacorrection.Similarly,theusercansimplyusethecorrespondingfunctionifhewantstomakeadestructiveoperationinhisownprogramundoable.Whenthefunctioniscalled,itwillsavetheinformationinthecurrenteventonthehistorylist.Theprogrammer'sassistantcannotknowwhethereciencyandoverheadareseriousconsiderationsfortheexecutionofanexpressioninauser,sotheusermustdecideifhewantstheseoperationsundoablebyexplicitlycalling,etc.However,expressionsrarelyinvolveiterationsorlengthycomputations.Therefore,beforeevaluatingtheuserinput,theprogrammer'sassistantsubstitutesthecorrespondingundoablefunctionforanydestructivefunction(see,page8.34).Forexample,iftheusertypes,itisactuallythatisevaluated.Obviously,withamoresophisticatedanalysisofbothuserinputanduserprograms,theTheeectsofthefollowingfunctionsarealwaysundoable:,,(usedtogiveafunctionacompiledcodedenition),,,,,,,,,,,,,,,,,,,,,,plusanychangescausedbyDWIM.8.22UNDOUNDOUNDOUNDOUNDONOTHINGSAVEDUNDOUNDO/RPLACA/RPLACAREMPROP/REMPROP/FNSBREAK/PUTD/REMPROP/RPLACA/RPLACD//UNDOprogram/MAPCONCtyped-indirectlyLISPX/(MAPCONCNASDIC)(/MAPCONCNASDIC)DEFINEDEFINEQDEFCDEFLISTLOADSAVEDEFUNSAVEDEFBREAKUNBREAKREBREAKTRACEBREAKINUNBREAKINCHANGENAMEEDITFNSEDITFEDITVEDITPEDITEEDITLESUBSTADVISEUNADVISEREADVISEy&H !}`m$|b'' \8 ixW   <? j%)+148;?DtV-  EiS(   #)** 24:=@GQ  L  !"#S'})w+0N27Z >@vDO   e/6 &2)T+04q57:<AB N7 :- P%!& /=45:y@ G(L  H ),.1858:<` C J ?B '7)-M 47u >@ IF urIv9!#b&X,2 29}BiCGjAO  @[ cT "'$)}-)/28::?? &$%(-t2537:3@IDj> !" ( :    -&6(.2[6 <@F,9Y "|L!"`&c(*-02r69=,?h G(7  0 #'*}-r/T1799;AB 6  ] ~$ *?-r3O8;C? H&4h  br $v*,w-3[7 >@G2 ++"/%](I / ?su "Y(!-/46<AyE|.  u  !p%1&)N/V457<=@PE,q  "Y)~2*9CDG* i '*d,S0]2 4g8 =!'  3d &, 35?G(& pB %.78Q;==AeB ${ F # .A357;=AB " 4"&*[/1 5`69C<7BZ !/   mq\*   #a(.179> G  \ik 0 ,()*-K0U3879;?C5   ##&2 9W=FB H9  L $,( /T149 ; D ? N"r(*d-# 4/9ABF#  X\}*m+ +x,-/.0}DDEGxGG  t t w! )/ 0467J;=@Gb  |8k"%)5[CI !)),/49%;(o"} `m$xS( J IF(.5AOCw? !H>0,qI#,I3{#6xI{,0n9x<$,5>-Eb0Q6]=A # ).^5I=C  ] %6 .5a:?D "\"} P`m$ =$} `m$THEPROGRAMMER'SASSISTANTdecisionconcerningwhichoperationstomakeundoablecouldbebetteradvised.However,wehavefoundthecongurationdescribedheretobeaverysatisfactoryone.Theuserpaysaverysmallpriceforbeingabletoundowhathetypesin,andifhewishestoprotecthimselffrommalfunctioninginhisownprograms,hecanhavehisprogramexplicitlycallundoablefunctions.8.5.1UndoingOutofOrderoperatesundoablybysaving(onthehistorylist)thelistcellthatistobechangedanditsoriginal.Undoingasimplyrestoresthesaved.Thisimplementationcanproduceunexpectedresultswhenmultiplesaredoneonthesamelistcell,andthenundoneoutoforder.Forexample,iftheusertypes,followedby,thenundoesbotheventsbyundoingthemostrecenteventrst,thenundoingtheolderevent,willberestoredtoitsstatebeforeeitheroperated.Howeveriftheuserundoestherstevent,thesecondevent,willbe,sincethisiswhatwasinofbeforewasexecuted.Similarly,iftheusertypes,followedby,undoingjustwillremovebothandfrom.Theprobleminbothcasesisthatthetwooperationsarenot``independent.''Ingeneral,operationsarealwaysindependentiftheyaectdierentlistsordierentsublistsofthesamelist.Undoinginreverseorderofexecution,orundoingindependentoperations,isalwaysguaranteedtodothe``right''thing.However,undoingdependentoperationsoutofordermaynotalwayshavethepredictedeect.Propertylistoperations,(i.e.,,and)arehandledspecially,sothatoperationsthataectdierentpropertiesonthesamepropertylistarealwaysindependent.Forexample,iftheusertypesthen,thenundoestherstevent,thepropertywillremain,eventhoughitmaynothavebeenonthepropertylistofatthetimethersteventwasexecuted.8.5.2SAVESETTyped-insaremadeundoablebysubstitutingacallto.ismadeundoablebysubstituting,andby,bothofwhichareimplementedintermsof.Inadditiontosavingenoughinformationonthehistorylisttoenableundoing,operatesinamanneranalogousto(page11.18)whenitresetsatoplevelvalue:whenitchangesatoplevelbindingfromavalueotherthantoanewvaluethatisnottotheoldone,savestheoldvalueofthevariablebeingsetonthevariable'spropertylistundertheproperty,andprintsthemessage.Theoldvaluecanberestoredviathefunction,whichalsosavesthecurrentvalue(butdoesnotprintamessage).Thuscanbeusedtoipbackandforthbetweentwovalues.Ofcourse,canbeusedaslongastheeventcontainingthiscalltoisstillactive.Notehoweverthattheoldvaluewillremainonthepropertylist,andthereforeberecoverablevia,evenaftertheoriginaleventhasbeenforgotten.andareimplementedviacallsto.Thusoldvalueswillbesavedandmessagesprintedforanyvariablesthatareresetastheresultofloadingale.Fortoplevelvariables,alsoaddsthevariabletotheappropriatespellinglist,therebynoticing8.23/RPLACACAR/RPLACACAR/RPLACA(RPLACAFOO1)(RPLACAFOO2)FOORPLACAthen(CARFOO)1CARFOO(RPLACAFOO2)(NCONC1FOO1)(NCONC1FOO2)(NCONC1FOO1)12FOOPUTPROPADDPROPREMPROP(PUTPROP'FOO'BAR1)(PUTPROP'FOO'BAZ2)BAZFOOSETSAVESETSETQSAVESETQSETQQSAVESETQQSAVESETSAVESETSAVEDEFNOBINDEQUALSAVESETVALUE(RESET)UNSETUNSETUNDOSAVESETUNSETRPAQRPAQQSAVESETSAVESETVARIABLE|b'!= -x\: n  !#'k-137=DEFZ  D !#d%K&l)q 036w9f<=@D:GX  O5" #e$&+,1O6'9 CDFWI Q@ = %(1.5 |R itxNz Cf"%i',/2 4m7:;=|?E'HL  %2*i,3t47 ADK4 O$+%'Y*,.2N4t7C9<AD3EI  ) */=>AFG ,0 p#W&})/15"A@ED( \#&+i0TACB  &;',:;e@AQ2%&)/04 78;>,@ G?  Z# #&*] 2A36:S?BDS>  a!!%)+p 239a A[ Hs<` A B0#* /h6 <?!@DtGj: L7 p x!N(W0139 >@C5 6  Y EA $)+.2k :=tC:DF4j 459=@mCNG2 1*m"#o&p(,$/}139r;@kBD^G1  ^|, ix(U ,~ # *,.6;=AG& \!+,0a2l69n B D H&% "  =8* #%(6,/05AAFH ^ Q]!%'(*'-/148<=CD*F @$ %'$*'-02I9;f=@Y  aD"k$v&j( .4;6g:V<F\G(m  L"c#&t(,/11-68;5DE  ]Yb!$%'(/W7:FBx!1$.5y8CwAQ  H^}#K7l"*4j -`#)*.3 2 =c(U07&$% "; ^z4CwB)mX@27.wA 'y !j } L`m$xm0} ,`m$UNDONLSETQandRESETUNDOvariablessetinlesviaor,aswellasthosesetviatype-in.[Function]Anundoable.scansthestacklookingforthelastbindingof,setsto,andreturns.Ifthebindingchangedwasatoplevelbinding,isaddedtothespellinglist(seepage15.14).Furthermore,iftheoldvaluewasnot,andwasalsonottothenewvalue,callsthelepackagetoupdatethenecessarylerecords.Then,ifisnotequalto,prints,andsavestheoldvalueonthepropertylistof,undertheproperty.If=,operatesasaboveexceptthatitalwaysuses'stop-levelvaluecell.Whenis,andisandtheoldvaluewasnot,simplystoresonthepropertylistofundertheproperty,andreturns.Thisoptionisusedforloadingleswithoutdisturbingthecurrentvalueofvariables(seepage5.9).If=,savestheoldvalue,butdoesnotprintthemessage.Thisoptionisusedby.If=,doessavetheoldvalueonthepropertylist,nordoesitaddto.However,thecalltoisstillundoable.Thisoptionisusedby.If=,isundoableonlyifthebindingbeingchangedisatop-levelbinding,i.e.thissayswhenresettingavariablethathasbeenrebound,don'tbothertomakeitundoable.Thisoptionisusedby,,and.[Function]Ifdoesnotcontainaproperty,generatesanerror.Otherwisecallswith,thepropertyvalue,=,and=.8.5.3UNDONLSETQandRESETUNDOThefunctionprovidesalimitedformofbacktracking:ifanerroroccursunderthe,allundoablesideeectsexecutedundertheareundone.,usedinconjunctionwithand(page9.19),providesamoregeneralundocapabilitywheretheusercanspecifythatthesideeectsbeundoneafterthespeciedcomputationnishes,isabortedbyanerror,orbyacontrol-D.[NLambdaFunction]Annlambdafunctionsimilarto(page9.15).evaluates,andifnoerroroccursduringtheevaluation,returnsandpassestheundoinformationfrom(ifany)upwards.Ifanerrordoesoccur,thereturns,andanyundoablechangesmadeduringtheevaluationofareundone.Anyundoinformationisstoreddirectlyonthehistoryevent(ifis8.24RPAQRPAQQ(SAVESET)SETSAVESETSPELLINGS3NOBINDEQUALSAVESETDFNFLGTSAVESET(RESET)VALUETSAVESETTDFNFLGALLPROPNOBINDSAVESETVALUENOPRINTSAVESETUNSETNOSAVESAVESETnotSPELLINGS3SAVESET/SETNOSTACKUNDOSAVESETRPAQRPAQQADDTOVAR(UNSET)VALUEUNSETUNSETSAVESETTNOPRINTUNDONLSETQUNDONLSETQUNDONLSETQRESETUNDORESETLSTRESETSAVE(UNDONLSETQ)NLSETQUNDONLSETQ(LIST(EVAL))UNDONLSETQNILLISPXHISTNAMEVALUETOPFLGFLGNAMENAMEVALUEVALUENAMENAMENAMETOPFLGNAMETOPFLGVALUENAMEVALUEFLGFLGNAMEFLGNAMENAMENAMETOPFLGFLGUNDOFORM_UNDOFORMUNDOFORMUNDOFORMUNDOFORM|b' )/+x\: i>Z"O#+$')o- /&1a4cY5C5 W"m)-"/u279CIUZ#$'{0R& %(),@/8:i>@5BGQ> #&+ 4n58a:>AiIOl j'),o/:g=@9BH0MK$'L,08 9<?BLM&')-0:268;_A"CIJ'GW (C-/48;=!AH}Em!/$.T01:$B,DGuDW.%,0l8t:[<BD/B'(\*3~4G7K;<@ B5GA  #5%*W-/5j85;x>"*-/2[6X8<>sAD3<` #)9["A*03\58<>ArGJ7R&*0a18,:=YEG?6-!E%'*>/3 r&- .Q417$8`:?C,Hs1e8|#&O(+/568;j>7@D/k !%'M.n16B7;M@FG(._+C5 )n 7"$'c({237=?u@Ca'2%K+,x.4<??DL|#d i x  !#J(D+- 7 8:>C6GYS!'|+j68EF  F(,0~6"7e;?C  'x7* #(*/?25#: CHsh e_ +c<C4 %*2?68C"_#%)G-24h ;eq #m'o)-# 4?PA D, !%158n9O< >D &c", (24o ! &''+1365:i>>Hs(o"}`m$x\:yY5 "W#?Q> CO#3M2hACwLM J#G!E/4z;DW %B#`>#<`%9[7#_{-vx7' ?(6,83  &/=zA.+ ^)n.2'>CF  Y - >Ix c %,t: @E&q(E 5 !@;}p`m$xY5{1 " WEpUE  "L,*,.oR4LMEpGanDE(,DW4+46pEB/0I1>&9[i7!3 +)n'(77;BRCc@q7< &*."}4`m$THEPROGRAMMER'SASSISTANTnot),sothatiftheusercontrol-D'soutofthe,theeventisstillundoable.willoperatecorrectlyifisorhasbeenexceededforthisevent,orisexceededwhileunderthescopeofthe.Note:Cautionmustbeexercisedinusingcoroutinesorothernon-standardmeansofexitingwhileunderan.Seediscussioninpage9.19.[Function]Foruseinconjunctionwith(page9.19).initializesthesavingofundoinformationandreturnsavaluewhichwhengivenbacktoundoestheinterveningsideeects.Forexample,willundothesideeectsofonnormalexit,orifanerroroccursoracontrol-Distyped.If=,stopsaccumulatingundoinformationitissavingon.Notethatthishasnobearingonthesavingofundoinformationonhigher's,oronbeingabletoundotheentireevent.Forexample,wouldcausetheadvicetobeundone,butanyofthesideeectsin.8.6FORMATANDUSEOFTHEHISTORYLISTThesystemcurrentlyusesthreehistorylists,forthetop-levelInterlispexecutive,fortheeditors,andforarchivingevents(seepage8.13).Allhistorylistshavethesameformat,usethesamefunctions,,forrecordingevents,andusethesamesetoffunctionsforimplementingcommandsthatrefertothehistorylist,e.g.,,,,etc.Eachhistorylistisalistoftheformq,whereisthelistofeventswiththemostrecenteventrst,qistheeventnumberforthemostrecenteventon,isthesizeofthetime-slice(below),i.e.,themaximumlengthof,andisthehighestpossibleeventnumber.andarebothinitializedto.Settingortodisablesallhistoryfeatures,soandactlikeagsaswellasrepositoriesofevents.Eachhistorylisthasamaximumlength,calledits``time-slice.''Asneweventsoccur,existingeventsareaged,andtheoldesteventsare``forgotten.''Foreciency,thestorageusedtorepresenttheforgotteneventisreusedintherepresentationofthenewevent,sothehistorylistisactuallyaringbuer.The8.25NILUNDONLSETQUNDONLSETQ#UNDOSAVESUNDONLSETQUNDONLSETQ(RESETUNDO)RESETLST(RESETUNDO)RESETUNDO(RESETLST(RESETSAVE(RESETUNDO)).)TRESETUNDORESETUNDO(RESETLST(SETQFOO(RESETUNDO))(RESETSAVENIL(LIST'RESETUNDOFOO))(ADVISE)(RESETUNDOFOOT).)notLISPXHISTORYEDITHISTORYARCHIVELSTHISTORYSAVEHISTORYFINDPRINTHISTORYUNDOSAVE()LISPXHISTORYEDITHISTORY(NIL0100100)LISPXHISTORYEDITHISTORYNILLISPXHISTORYEDITHISTORYXSTOPFLGFORMSFORMSSTOPFLGXFORMSFORMSLEVENTSIZEMODLEVENTLSIZELMOD|b'!= -x\:"j#&) -0&24D??B/EG?ZW #Z(P.8k9;>:AGUEO !{'i+/1v5>6AR $/&,-1U 79=J@ EQ>^!%/03T 9;|>N9C5 L' &1m5\C JX $ ,/464:/>BFIH!&): 038;G3159<>CKEc!d#'$&u).%/157U8B )-h 59\ @B7CGAQ~* $"%',/167; C^E?6 "$(|+r-03 6<O}4 !"x._!& ')/368D:=wAG|'< i)#!*.x"   U.$2|5 7:#=C !1k 5*X,3 7:>BEP  4QK a# 347=ZBDG  S #8*E-?025"9<I@q;  q )})lx2h39;/=@PBLF  /} "x"#&f*]/2M48<@CHs  zu.~ &# %,m034;S=?DJ -:/3 :QI %*0f27i=> b=_ "$ +-  b6_"&(,025:(>DCPG S  tQ %(/16P9;hAzC  .b "%(,0.0u57e8>?CB6G(o}l`m$4x\:6 W /p U9R Q>'~ N9 }L)9 IHAG +1B #!?97,6" 6V, #j&+ 54,"~3 , #j&1e, {._1x"' !1 !+ *y ? @ ;"1J # EEB(AQ1e._CYD;#%F+h.7C8E!27}@`m$J3434FormatandUseoftheHistoryListtime-sliceofahistorylistcanbechangedwiththefunction,page8.18.Largertime-slicesenablelonger``memoryspans,''buttieupcorrespondinglygreateramountsofstorage.Sincetheuserseldomneedsreally``ancienthistory,''andafacilityisprovidedforsavingandrememberingselectedevents(seeand,page8.12),arelativelysmalltime-slicesuchas30eventsismorethanadequate,althoughsomeusersprefertosetthetime-sliceaslargeas100events.If(page8.18)issetto,an``eventnumber''willbeprintedbeforeeachprompt.Morerecenteventshavehighernumbers.Whentheeventnumberofthecurrenteventis100,thenexteventwillbegivennumber1.Ifthetime-sliceisgreaterthan100,the``roll-over''occursatthenexthighesthundred,sothatatnotimewilltwoeventseverhavethesameeventnumber.Forexample,ifthetime-sliceis150,eventnumber1willfolloweventnumber200.Eachindividualeventonisalistoftheform.isthepromptcharacterforthisevent,e.g.,,,,etc.isthevalueoftheevent,andisinitializedtobell.isapropertylistusedtoassociateotherinformationwiththeevent(describedbelow).istheinputsequencefortheevent.Normally,thisisjusttheinputthattheusertyped-in.Foranformatinput,thisisalistconsistingoftwoexpressions;foranformatinput,thisisalistofjustoneexpression;foraninputenteredaslistofatoms,issimplythatlist.Forexample,UserInputis:Iftheusertypesinaprogrammer'sassistantcommandthat``unreads''andreexecutesotherevents(,,,etc.),containsa``sequence''oftheinputsfromtheredoneevents.Specically,theeldsfromthespeciedeventsareconcatenatedintoasinglelist,seperatedbyspecialmarkerscalled``pseudo-carriagereturns,''whichprintoutasthestring.Whentheresultofthisconcatenationis``reread,''thepseudo-carriage-returnsaretreatedbyandexactlyasrealcarriagereturns,i.e.,theyservetodistinguishbetweenandformatsoninputsto,andtodelimitlinecommandstotheeditor.Thesameconventionisusedforrepresentingmultipleinputswhenacommandinvolvessequentialsubstitutions.Forexample,iftheusertypesandthen,theinputsequencethatwillbeconstructedis,whichistheresultofsubstitutingforinconcatenatedwiththeresultofsubstitutingforin.Notethatonceamultipleinputhasbeenenteredastheinputportionofanewevent,thateventcanbetreatedexactlythesameasoneresultingfromtype-in.Inotherwords,nospecialcheckshavetobemadewhenanevent,toseeifitissimpleormultiple.ThisimplementationpermitsanOn,thiseldisusedtosavethesideeectsofeachcommand.Seepage8.35.Thevalueofthevariableisusedtorepresentapseudo-carriagereturn.Thisisinitiallythestring.Notethatthefunctionsthatrecognizepseudo-carriagereturnscomparethemtousing,sothismarkerwillneverbeconfusedwithastringthatwastypedinbytheuser.8.26CHANGESLICENAMERETRIEVEPROMPT#FLGT(.)_:*APPLYEVALPLUS[11](PLUS(11))(PLUS11)((PLUS11))PLUS11cr(PLUS11)REDOUSE""LISPXREADREADLINEAPPLYEVALLISPXUSEGETD(FOO)USEFIEFUMFORFOO(GETD(FIE)""GETD(FUM))FIEFOO(GETD(FOO))FUMFOO(GETD(FOO))referencingEDITHISTORYHISTSTR0""HISTSTR0EQLINPUTIDVALUEPROPSIDVALUEPROPSINPUTINPUTINPUTINPUTINPUTyGA*P1 I }`m$|b'#&O)*-!2x\:  X #P&_(7\8/;i>C5FMZ j "$.39@;@DlFX ^ "%%&S*,249F<# DWI 3 "O&'0 -036:;=AC,FU b "$'*.-:.2J36R {I;g!"$)_/H248=B@F!P Q 6$R&*p/1_38)l,/f3 6=?EGL  ze>r!%O).(I  E Eh "8;<?+CG\  7]M"$%&*I,.~25a6 =;>G:HE C 'a*y,0 7&B.n$0*-F.1F37B: 8BHDFkG?e  B Q@$&(*w34~8;>tA;5  :..  ]  t$+- 4D6 =yAE,I-2 q 5 #%U',/{16; C&+  /q ; (+,039;@E) JO !#h$'/13H7;9v=>A0 (A  < a,!#(v2O< @BD& ~ !+27: >YD[EYH0$ N-8!  D S> &+/3q7> Ca J b 6!-./BCF6  ;G<<@ZADJH& Fx% -03868 BH0YT  zaT $W)b+*-1d6Z8,9pDH0 'zT i#&(.1269g<?ACE(o"} `m$x\:. WIzR ~ !&I&(2f8G\A 58= */2(51 *0z2(2, z2Tx2,*/1Q.E-2 )*(A*V4&'.@(!4 J%36b9=@w d%n*y2 6<Gx %?E1Y { x  ]E } `m$xI3&+-.Y/459G\2 wBDPB ?e.;5*-2.E u=$ } 8`m$B55THEPROGRAMMER'SASSISTANTeventspecicationtorefertoasinglesimpleevent,ortoseveralevents,ortoasingleeventoriginallyconstructedfromseveralevents(whichmaythemselveshavebeenmultipleinputevents,etc.)withouthavingtotreateachcaseseparately.,,,,andcommands,i.e.,thosecommandsthatreexecutepreviousevents,arenotstoredasinputs,becausetheinputportionfortheseeventsaretheexpressionstobe``reread''.Thehistorycommands,,,,andrecordedasinputs,andprintsthemexactlyastheyweretyped.isapropertylistoftheform,thatcanbeusedtoassociatearbitraryinformationwithaparticularevent.Currently,thefollowingpropertiesareusedbytheprogrammer'sassistant:Alistofthesideeectsoftheevent.See,page8.33.Usedbythecommandwhenspecialformattingisrequired,forexample,whenprintingeventscorrespondingtothebreakcommands,,,and.Theandpropertiesareusedtosavetheargumentsandexpressionforthecorrespondinghistorycommand.andareusedtosaveinformationwhenerrorsoccurforsubsequentusebythecommand.Wheneveranerroroccurs,theoenderisautomaticallysavedonthatevent'sentryinthehistorylist,undertheproperty.Usedtorecordcallsto,,etc.(seepage8.20).Thepropertyonaneventcausestheeventtobeautomaticallyarchivedwhenit``fallsotheend''ofthehistorylist(seepage8.13).Theandpropertiesareusedforcommandsthatreexecutepreviousevents,i.e.,,,,,and.Thevalueofthepropertyisthehistorycommandthattheuseractuallytyped,e.g.,.Thisisusedbythecommandwhenprintingtheevent.Thevalueofthepropertyisastructurecontainingthesideeects,etc.fortheindividualinputsbeingreexecuted.Thisstructureisdescribedbelow.Whenisgivenaninput,itcalls(page8.32)torecordtheinputinanewevent.Normally,createsandreturnsanewevent.bindsthevariabletothevalueof,sothatwhentheoperationhascompleted,knowswheretostorethevalue.Notethatbythetimeitcompletes,theoperationmaynolongercorrespondtothemostrecenteventonthehistorylist.Forexample,allinputstypedtoalowerbreakwillappearlaterontheThecommands,,,,andareexecutedimmediately,andarenotrecordedonthehistorylist.8.27REDORETRYUSE...FIXUNDONAMERETRIEVEBEFOREAFTERare??()SIDEUNDOSAVE*PRINT*??OKGOEVAL?=USE-ARGS...ARGSUSE-ARGS...ARGS*ERROR**CONTEXT**ERROR**CONTEXT*$*ERROR**LISPXPRINT*LISPXPRINTLISPXPRIN1*ARCHIVE**ARCHIVE**GROUP**HISTORY**HISTORY**GROUP*REDORETRYUSE...FIX*HISTORY*REDOFROMF??*GROUP*LISPXHISTORYSAVEHISTORYSAVELISPXLISPXHISTHISTORYSAVELISPX??FORGETTYPE-AHEAD$BUFSARCHIVEPROPSPROPERTY1VALUE1PROPERTY2VALUE2yH !}`m$|b'!= -x\:  Pu!&%*I, -27+9:<?C Z Uz"g% ,/3Z8<AYDX c>lX U Ha8!'6)-{4d7:=^BGTD  iIg"&)C,13n5 =>@ GR x$*e+@4:<_@EP  r Mq };<=6x>n?QB"DFLM  5 U!l" (, 35; B\DGJ  I  G1m$"W&(D*.8#8 68W>3@fF+B! *+.1:p<A2BFq>L"4+ 2x58~:i=@BG(< X " +0m73)J+/#04 ;?CG6V !#'/57;@OBHs4 *$ &&) -1X35:9<A3 07!/$;.O78m;"=A/-V')+\.2508:D< DR+ZX G"b$(#),80359&"+ 2747:@C% ").s2657N<>'A^EfG#d%'*).^47:R=nBF! !$&p)+07(:@6BG Z %+-.P4 :=A@%DGr $(r /28:@3m 7H,$/3R59X;?jABNE@ n!&'*4\86:H0"  h-A<!$'T-0) <&@DF|  v&o!A (7*14?6q: B CF L {&T(N,0c23P7";=BBEpG V  a%=*X+C4t6< DG  _w(o"}`m$xU .GRW%Z-{2xCM s=G 1jD vB8;L=D?  H>L %&9 7 !6V&84Cw0 % /+ - (U & %U% %*?/3s:e#d! .0 m"[  /?" 7P VL! &%. }p`m$xM  !J"&7M'M)S*+M-7M.0K3M5AM67[8M: =$ } $`m$D66Programmer'sAssistantFunctionshistorylist.Afterbinding,executestheinput,storesitsvalueinthevalueeldoftheevent,printsthevalue,andreturns.Whentheinputisa,,,,orcommand,theprocedureissimilar,exceptthattheeventisalsogivenaproperty,initially,andaproperty,andsimplyunreadstheinputandreturns.Whentheinputis``reread'',itis,not,thatnoticesthisfact,andndstheeventfromwhichtheinputoriginallycame.thenaddsanewentrytothepropertyforthisevent,andreturnsthisentryasthe``newevent.''thenproceedsexactlyaswhenitsinputwastypeddirectly,i.e.,itbindstothevalueof,executestheinput,storesthevalueinof,printsthevalue,andreturns.Infact,nevernoticeswhetheritisworkingonfreshlytypedinput,orinputthatwasreread.Similarly,willstoreundoinformationonthesameasalways,anddoesnotknoworcarethatisnottheentireevent,butoneoftheelementsoftheproperty.Thuswhentheeventisnished,itsentrywilllooklike:Inthiscase,thevalueeldoftheeventwiththepropertyisnotbeingused;insteadreturnsalistofthevaluesfromtheproperty.Similarly,operatesbycollectingthepropertiesfromeachoftheelementsoftheproperty,andthenundoingtheminreverseorder.Thisimplementationremovestheburdenfromthefunctioncallingofdistinguishingbetweennewinputandreexecutionofinputwhosehistoryentryhasalreadybeensetup.8.7PROGRAMMER'SASSISTANTFUNCTIONS[Function]istheprimaryfunctionoftheprogrammer'sassistant.takesoneuserinput,savesitonthehistorylist,evaluatesit,savesitsvalue,andprintsandreturnsit.alsointerpretesp.a.commands,,,and.Ifisalist,itisinterpretedastheinputexpression.Otherwise,calls,andusesplusthevalueofastheinputfortheevent.Ifisalistofwhichisor,callstoobtainthearguments.isthepromptcharactertoprintbeforeacceptinguserinput.Ausercancallspecifyinganypromptcharacterasexceptfor,sinceinIfcannotndtheevent,forexampleifauserprogramunreadstheinputdirectly,andnotviaahistorycommand,proceedsasthoughtheinputweretyped.8.28LISPXHISTLISPXLISPXHISTREDORETRYUSE...FIX*GROUP*NIL*HISTORY*LISPXHISTORYSAVELISPXHISTORYSAVE(.)*GROUP*LISPXLISPXHISTHISTORYSAVECADDRLISPXHISTLISPXUNDOSAVELISPXHISTLISPXHIST*GROUP*(*HISTORY**GROUP*((SIDE)(SIDE)))*GROUP*VALUEOF*GROUP*UNDOSIDE*GROUP*HISTORYSAVE(LISPX)LISPXLISPXLISPXLISPXMACROSLISPXHISTORYMACROSLISPXUSERFNLISPXREADLINEREADLINECARLAMBDANLAMBDALISPXLISPXREADLISPX*HISTORYSAVEHISTORYSAVEINPUTIDVALUEPROPSINPUTIDVALUECOMMANDINPUT1ID1VALUE1SIDE1INPUT2ID2VALUE2SIDE2LISPXXLISPXIDLISPXXMACROSLISPXXUSERFNLISPXFLGLISPXXLISPXXLISPXXLISPXIDLISPXIDyS; !}`m$|b'g ((. x\: y$!'-/|37}9f=>AGDH&Z ]fO"%`W Gc"&v'm,e345<:=BGU  xY &./2~<BBTD ~P"&)_-.. 46bA2B4IR  NxL C$'+.>2 8<FP  B$(*j3g9;r>.B\E.OR  L;":%u+D/157v;6=AGKM  XWN*[+N03O7l;`=AH&L{P1.$]&#-16 ;b<>C^E[Ja  z !S .1`48F ?H  QL ?"$I'>2.368Q|( i $>x#C5 "{!2&,.1S :c Fc ^"E&'*,14:<@BG(#*- 48LI&'3F!,#%s' .=026k > h!"y%G-:0J26?AkCG W$&%'U,.h2z9A.F!g%( ] %+-l05:;X>]BDOGTq` &(. 4-;@ C\DH0 ] R1#%+i,.16;>&AG(  ^O$*{,'0346:)(o"},`m$nx\:F"Z IWT z#)FU#, 3E&TD7 DR< P#y,ORjM,! CWL )Ja'AH*GD Bk?=y*!)p;!)p:.r7)'>52^E3$05% # 4"AR&? *W E&h8P)3;LBqlB ]  }0`m$xPgY}!$D \o@*=y==y=B=y]= =y&2=(;;j;;jB;];j ;&2;j(# "X$ .3Qh(Vq6 =$"}`m$THEPROGRAMMER'SASSISTANTcertaincasesmustusethevalueoftotellwhetherornotitwascalledfromtheeditor.Ifisnot,itisusedasthelistofmacros,otherwisethetoplevelvalueofthevariableisused.Ifisnot,itisusedasthe.Inthiscase,itisnotnecessarytobothsetanddeneasdescribedonpage8.20.isusedbythecommandintheeditor(seepage8.35).Notethatthehistoryisoneoftheargumentsto,i.e.,theeditormustbind(reset)tobeforecallingtocarryoutahistorycommand.willcontinuetooperateasan/functionifis.Onlythosefunctionsandcommandsthatinvolvethehistorylistwillbeaected.performsspellingcorrectionsusing,alistofitscommands,asaspellinglistwheneveritisgivenanunboundatomorundenedfunction,beforeattemptingtoevaluatetheinput.isresponsibleforrebinding,usedby(page9.10)forcomputingtheamountoftimespentinacomputation,inordertodeterminewhethertogointoabreakifandwhenanerroroccurs.[Function]Repeatedlycallsundererrorsetprotectionspecifyingand,andusing(orif=)asapromptcharacter.isexitedviathecommand,orelsewitha.[Function]Evaluates(using)thesameasthoughitweretypedinto,i.e.,theeventisrecorded,andtheevaluationismadeundoablebysubstitutingtheslashfunctionsforthecorrespondingdestructivefunctions(seepage8.22).returnsthevalueoftheform,butdoesnotprintit.Whenrecievesan``input,''itmaycomefromtheusertypingitin,oritmaybeaninputthathasbeen``unread.''handlesthesetwocasesbygettinginputswithand,describedbelow.Thesefunctionsusethevariabletostoretheexpressionsthathavebeenunread.Whenisnot,and``read''expressionsfromuntilis,oruntiltheyreadapseudo-carriagereturn(seepage8.26).Bothfunctionsreturnalistoftheexpressionsthathavebeen``read.''(Thepseudo-carriagereturnisnotincludedinthelist.)Whenis,bothandactuallyobtaintheirinputbyperforming,whereisinitiallysetto.Theusercanmake,theeditor,break,etc.dotheirreadingviaadierentinputfunctionbysimplysettingtothenameofthatfunction(oranappropriateexpression).Note:Theusershouldonlyaddexpressionstousingthefunction(page8.31),whichknowsabouttheformatof.8.29LISPXNILLISPXLISPXMACROSNILLISPXUSERFNLISPXUSERFNEnotLISPXLISPXHISTORYEDITHISTORYLISPXLISPXEVALAPPLYLISPXHISTORYNILLISPXLISPXCOMSLISPXHELPCLOCKBREAKCHECK(USEREXEC)LISPX_NILUSEREXECOKRETFROM(LISPXEVAL)EVALLISPXLISPXEVALLISPXLISPXLISPXREADREADLINEREADBUFREADBUFNILREADLINELISPXREADREADBUFREADBUFNILREADBUFNILLISPXREADREADLINE(APPLY*LISPXREADFN)LISPXREADFNREADLISPXLISPXREADFNLAMBDAREADBUFLISPXUNREADREADBUFLISPXIDLISPXXMACROSLISPXXUSERFNLISPXFLGLISPXIDLISPXXMACROSLISPXXUSERFNLISPXXMACROSLISPXXUSERFNLISPXIDLISPXIDLISPXFORMLISPXIDLISPXFORMFILE|b'!= -x\8?$( *-079< AhCAEG4Z![W"$Z)G*+a,/136"?@CGHsQ< '!% '')79j?ADN7s"$(].0e269<K2' k%(+-h/6DhFA#'(,A/58?BGD4o!#AW"''1 . 9O:%;G=|?-@H0? &%'q(,z._4979d?E>J  3%';E? $&4^585BFz9 #7(I* -:023 <3=ACa7 #`$([),o0!25~4C5 3N &*0 6 G(1 !$e-C06:;=>C 0 M$b&(1136V9m@x,C5 +X%/,-/3.49b:=AC5I)i "V(+q- 46J:.@XBy ( ?$ &) 2B 9i?BF#&g$h&*l,#.2<47:[=#a (0 !$5'+p-05O68:<(?BAJCQG!  `  #&;)+064c?I  ?U"H$026)8 @CFp j ) 48 ? wN J S#f$)8.Z25F8*- .48>^@E{.Zt+%l') 6| )  1 %--030BfF"  6q$(o!}`m$x\8W&7U*I R'4 Q<- N7'{K2&}x8BI +B =G$Q;?FA %HA1;E,: 4 +H3N" 1/8R0/U:, +X):D&g#a!G7}BH *3p5!+Cw + (I3(Mz  s# 8 . 0)&8 }`m$x\82W< R< N74S"$ 3N=(CIE1 (2H,*X+X!z"} `m$LProgrammer'sAssistantFunctions[Function]Readsalinefromtheterminal,returningitasalist.Ifis,returns.Otherwiseitreadsexpressionsbyperforming(isinitiallysetto)untilitencounterseither:acarriage-return(typedbytheuser)thatisnotprecededbyanyspaces,e.g.,andreturnsalistterminatingina``'',inwhichcasethelistisincludedinthevalueof,e.g.,andreturns.anunmatchedrightparenthesesorrightsquarebracket,whichisnotincludedinthevalueof,e.g.,andreturns.Inthecasethatoneormorespacesprecedeacarriage-return,oralististerminatedwitha``'',willtype``''andcontinuereadingonthenextline,e.g.,andreturns.Iftheusertypesanothercarriage-returnafterthe``'',thelinewillterminate,e.g.,andreturns.Notethatcarriage-return,i.e.,thecharacter,canberedenedwith(page6.34).actuallychecksforthecharacter,whateverthatmaybe.Thesameistrueforrightparenthesisandrightbracket.Wheniscalledfrom,itoperatesdierentlyintworespects:(1)Ifthelineconsistsofasingleor,returnsinsteadof,i.e.,theorincludedintheline.Thispermitstheusertotypeor,meaningcallthefunctionwithnoarguments,asopposedto8.30(READLINE)(READPT)NILREADLINENIL(APPLY*LISPXREADFNT)LISPXREADFNREADABCcrREADLINE(ABC)]READLINEAB(CD]READLINE(AB(CD))READLINEABC]READLINE(ABC))READLINE...ABCcr...(DEF)...(XYZ]READLINE(ABC(DEF)(XYZ))...ABCcr...crREADLINE(ABC)EOLSETSYNTAXREADLINEEOLREADLINELISPX)]READLINE(NIL)NIL)]isFOO)FOO]FOOFOOcrRDTBL__|b'g ((. x[C5 ZRY B#&n,|24?6!7:DIX&A'1-/,2 :(<7 W$.0!5K7<=AnB Ua}R\x#I')+/[2'36;=@E LR!}ILxS $6& '[(*,t036?8:5?ADWH&G_;A!/}>x!% ,Z.1U5:>@3BH0<&&6!,(3^}!3#%t(-23*8E<>d?wAB 2<&)m,/1{4K:?A1CF0'@!9$;;"\'w,0469;j=@Ca "!,("'). 47&8>:j&+0.2p7 >*D F h!$&*= 1_47b"$a(U/027 >"?Bx  %').1R9CWH& ,!&J+-0$36;>A$B >#;%(%035 <>xC(o } `m$x[ ZR<BuF|X#CwW !$ 9rOWTzO xLR[&G(*zIL( GDTA[&F(*z,<b9T6[&G(*z2<Q-E-Tz- x+_*E_'@[&F(*z,(.0[25f7$;7@Tz xzTZx[&G(*z+A:g4+-0{2V>  )#e{$xE >k-Ez HQH"} ,`m$x[SYd }8`m$THEPROGRAMMER'SASSISTANT(),meaningevaluatethevariable.(2)Iftherstexpressiononthelineisalistthatisnotprecededbyanyspaces,thelistterminatesthelineregardlessofwhetherornotitisterminatedby.Thispermitstheusertotypeasasingleinput.Notethatifanyspacesareinsertedbetweentheatomandtheleftparenthesesorbracket,willassumethatthelistdoesnotterminatetheline.Thisistoenabletheusertotypealinecommandsuchas.Therefore,iftheuseraccidentiallyputsanextraspacebetweenafunctionanditsarguments,hewillhavetocompletetheinputwithanothercarriagereturn,e.g.,[Function]Ageneralized.If=,performs,whichitreturnsasitsvalue.Ifisnot,``reads''andreturnsthenextexpressionon.Note:Iftheusertypescontrol-Uduringthecallto,callstheeditorandreturnstheeditedvalue.alsosetstowhenitreadsvia,andsetstothevalueofwhenrereading.[Function]Ageneralized.If=,returnsifthereisanyinputwaitingtobe``read'',inthemannerof.If=,returnsonlyifthereisanyinputwaitingtobe``read''Inbothcases,leadingspacesareignored,i.e.,skippedoverwith,sothatifonlyspaceshavebeentyped,willreturn.[Function]Unreads,alistofexpressions.[Function]Calledbytoprintthepromptcharacterbeforeeachinput.willnotprintanythingwhenthenextinputwillbe``reread'',i.e.,whenisnot.willnotprintwhen=,unlessis.Theeditorcallswith=sothatextra'sarenotprintedwhentheusertypesseveralcommandsononeline.However,callswith=,sinceitalwayswantstheprinted(exceptwhen``rereading'').If(page8.18)isandisnot,printsthecurrenteventnumber(of)beforeprinting.Thevalueof(page8.18)isalistofexpressionsthatareevaluatedbybefore,andif,itdoesanyprinting.8.31FOOFOO]EDITF(FOO)READLINEUSE(FOO)FORFOO_EDITF(FOO)...crEDIT*(LISPXREAD)READREADBUFNILLISPXREAD(APPLY*LISPXREADFN)READBUFNILLISPXREADREADBUFREADLISPXREADLISPXREADREREADFLGNILREADREREADFLGREADBUF(LISPXREADP)READPTLISPXREADPTLISPXREADNILLISPXREADPTonthisline.READCLISPXREADPNIL(LISPXUNREAD)(PROMPTCHAR)LISPXPROMPTCHARREADBUFNILPROMPTCHAR(READP)TTPROMPTCHARNIL*EVALQTPROMPTCHART_PROMPT#FLGTNILPROMPTCHARPROMPTCHARFORMSPROMPTCHARFILERDTBLFILEFLGFLGFLGLST_LSTIDFLGHISTORYIDFLGFLGFLGHISTORYHISTORYID|b'!= -x\: p&+13k;"Y5o 't)+.0:1u368:@BEOW6 "%1' .6/5-69Y:< BEFU!#/1<2d6LR W!&7(-3659;>9@ HQ>$&+X.0k258&>?@CFH0O0! "%&):/{2BjC+ McZ &6)8+'.2H78>OAB LM>!.')n-0-54:Z>AQC5 ?P#l$+Q/679>6 !i&')-57;D<`[ !g$t%(;+&3 9[F"&]+,10367;QDcG7Z#%f)4 #.d379M=4CD>G>3 !g#'j/39 0C5 ._Y $%*,:6P<>0ACpF6,y+ $&).7[8:<-@+ !%i&)W,13Q53A*BF)n #J(+z03;F<<>@BwE'C+Z.4$C5 #j F!o#%b C5 r"S#'()g./59<P *%)+.25H79 =2?' " #>%)245<??BF| &+$-04628;d@jDSFB&(+.:F0K' !&L*)-27v;(+"J&#),5Z6;E"z'/04b: -15768;= DG (-R0136A8(o}`m$"x\:8WDU& Q>O4!7~<?IHGzH ZxEDWAQ ? %o,/=xD0 >_/:9s<<`-*9[7<>4&0\?3 )"0 o._ +c-= ;&,/=@ +G{9;> x)n7'"o 2-$ (  r@ Cw'" ,4>E| '35= 0t,+C +)9p<   }`m$xAQ*>0._'),9;E$#% kr3"9;j|$%0,+/q3).C9}D`m$\Programmer'sAssistantFunctions[Function]Recordsoneeventon.Ifisnot,theinputisoftheform.Ifis,andisnot,theinputisoftheform.Otherwise,theinputisjust.createsaneweventwiththecorrespondinginput,,valueeldinitializedtobell,and.Ifthehasreacheditsfullsize,thelasteventisremovedandcannibalized.Thevalueofisthenewevent.However,ifisnot,andthemostrecenteventonthehistorylistcontainsthehistorycommandthatproducedthisinput,doesnotcreateanewevent,butsimplyaddsanentrytothepropertyforthateventandreturnsthatentry.Seediscussiononpage8.28.(page8.18)isalistofexpressionsthatareevaluatedundererrorsetprotectioneachtimecreatesanewevent.[Function]Usedbyforstoringthevalueofanevent.Canbeadvisedbyusertowatchforparticularvaluesorperformothermonitoringfunctions.[Function]isaneventspecication,speciestheformatofthevaluetobereturnedby,andcanbeeither,,,,,or.parses,andusestondthecorrespondingevents.thenassemblesandreturnstheappropriatestructure.incorporatesthefollowingspecialfeatures:(1)if=,interpretsinthecontextofthehistorylistthecurrenteventwasadded.Thisfeatureisused,forexample,by,sothatwillnotrefertotheeventitself.(2)if=andthelasteventisan,thenexttothelasteventistaken.Thispermitstheusertotypefollowedbyor.(3)recognizes,andsubstitutesfor(seepage8.13).(4)recognizes,andretrievesthecorrespondingevent(s)fromthepropertylistoftheatomfollowing(seepage8.12).[Function]Searchesandreturnsthetailsofbeginningwiththeeventcorrespondingto.,,andaretherstthreeelementsofa``historylist''structure(seepage8.25).isaneventaddress(seepage8.5)e.g.,,,,,etc.Ifcannotnd,itgeneratesanerror.8.32(HISTORYSAVE)NIL(.)NILNIL(.)HISTORYSAVEHISTORYSAVEREREADFLGNILHISTORYSAVE(bell.)*GROUP*HISTORYSAVEFORMSHISTORYSAVE(LISPXSTOREVALUE)LISPX(LISPXFIND)LISPXFINDENTRYENTRIESCOPYCOPIESINPUTREDOLISPXFINDHISTORYFINDLISPXFINDLISPXFINDTLISPXFINDbeforeVALUEOF(VALUEOF-1)VALUEOFNILUNDOUNDOREDOUSELISPXFIND@@ARCHIVELSTLISPXFIND@@(HISTORYFIND)(43)(-1)(FOOFIE)(LOAD_FOO)HISTORYFINDHISTORYIDINPUT1INPUT2INPUT3PROPSHISTORYINPUT1INPUT1INPUT2INPUT3INPUT1INPUT2INPUT2INPUT3INPUT3IDPROPSHISTORYINPUTIDPROPSEVENTVALUEHISTORYLINETYPEBACKUP_LINETYPELINEBACKUPLINELINEHISTORYLSTINDEXMODEVENTADDRESS_LSTLSTEVENTADDRESSLSTINDEXMODEVENTADDRESSEVENTADDRESS|b'g ((. x\:C5 Z#U*W+$%(+-Q/1GH\U " *+0248:E<<>TD $'*,3Q>!~&'U*V.1K3 <BC FO #+*+,5!7<>ADG_MX"m%" Je* +.+175<)EGjIH, H#'+-0"47 CGx #=1 4?6:;>BEqE035>DGDWX "%),. 247AQ%)_,.3/_13Y :=a?E? #4&b3F78;@ /$r'-05H7 > , ')/4a) ["+ 5x7A9>@}BG("x& (-00)459s;ADI&ii&)v+/709=X#d"W%'Y)-y.447H:M;>G@DgE!" %&-3;9=]"= *+. >G" )*-3)5 >CGh<w!/#'.n184|cC5  "'),1R7:=9@ "%*+]1O358<#ACDq h#B&46H8F<@CG*"Y*569Ee &$ $&=,@./(o!}`m$x\: 0W"15@;FBUk.wB|HTDQ> J = =IHG'D E/$(.8IAQ?) < !; 6V (+3 -!208=%C 1e0 /_,)!#{(xC &i4#$3A#dU0!)55:)5 (h-c + #T'+02; !}p`m$x\:I"T',.kZ%Y)W;5W&9W; W&>WAW&EUUiU%U(UCSUGTDSiTD.S2Q>@O&'//3E"*,;<4:6V*R !+"'4)1e')e1#dAEc I$V*K.KX#&. q*. &}"}`m$77THEPROGRAMMER'SASSISTANT[Function]Usedbyfor``matching''whenspeciesapattern.Matchesagainst,theinputportionofthehistoryevent,asmatchingisdenedonpage17.13.Initiallydenedas,butcanbeadvisedorredenedbytheuser.[Function]isahistorylist(seepage8.25).istooneoftheeventson.returnstheeventnumberfor.[Function]addsthe``undoinformation''tothepropertyofthehistoryevent.Ifthereisnoproperty,oneiscreated.Ifthevalueofthepropertyis,theinformationisnotsaved.speciesanevent.If=,thevalueofisused.Ifbothandare,isano-op.Notethat(or)caneitherbea``real''event,oraneventwithinthepropertyofanotherevent(seepage8.28).Theformofis.Undoingisdonebyperform-ing.Forexample,ifthedenitionofis,willcauseacalltowith=.ofthepropertyofaneventisacountofthenumberofssavedforthisevent.Eachcalltoincrementsthiscount.Ifthiscountissetto-1,thenitisneverincremented,andanynumberofscanbesaved.Ifthiscountisapositivenumber,restrictsthenumberofssavedtothevalueof,describedbelow.initializesthecountto-1,sothatregardlessofthevalueof,nomessagewillbeprinted,andthewillbeundoable.[Variable]Thevalueofisthemaximumnumberofstobesavedforasingleevent.Whenthecountofsreachesthisnumber,printsthemessage,askingtheuserifhewantstocontinuesaving.Iftheuseranswersordefaults,discardsthepreviouslysavedinformationforthisevent,andmakesbethevalueoftheproperty,whichdisablesanyfurthersavingforthisevent.Iftheuseranswers,changesthecountto-1,whichisthenneverincremented,andcontinuessaving.Thepurposeofthisfeatureistoavoidtyinguplargequantitiesofstorageforoperationsthatwillneverneedtobeundone.Ifisnegative,thenwhenthecountreaches-,simplystopssavingwithoutprintinganymessagesorinteractingwiththeInthespecialcaseofand,theformatofis.Whenisundone,thisformisrecognizedandhandledspecially.Thisimplementationsavesspace.8.33(HISTORYMATCH)HISTORYFIND(EDITFINDPT)(ENTRY#)EQENTRY#(UNDOSAVE)UNDOSAVESIDESIDESIDENOSAVENILLISPXHISTLISPXHISTNILUNDOSAVELISPXHIST*GROUP*(.)(APPLY(CAR)(CDR))FOO(/PUTDFOO)UNDOSAVE(/PUTDFOO)CARSIDEUNDOSAVEUNDOSAVE#UNDOSAVESLOAD#UNDOSAVESLOAD#UNDOSAVES#UNDOSAVESUNDOSAVECONTINUESAVING?NOUNDOSAVENOSAVESIDEYESUNDOSAVE#UNDOSAVES#UNDOSAVESUNDOSAVE/RPLNODE/RPLNODE2(.)INPUTPATEVENTEVENTADDRESSPATINPUTEVENTINPUTPATHISTXHISTXHISTXUNDOFORMHISTENTRYUNDOFORMHISTENTRYHISTENTRYHISTENTRYHISTENTRYHISTENTRYUNDOFORMFNARGSUNDOFORMUNDOFORMDEFNEWDEFUNDOFORMDEFUNDOFORMUNDOFORMUNDOFORMUNDOFORMUNDOFORMUNDOFORMXOLDCAROLDCDRUNDOFORMy<3 I !}`m$|b'!= -x\:C5 Z6&)+ 0>FCDX _(*,057:7?GH0WI#& )R-27UT08!'&'-/2@RC5 P.F!#&)/ 24#68c:>CORU"d'*LMC5 J"$g( 8f: @?EGI!&'q(,T-3m9K;=;B}CF7G\^%1+,. 6b7:?DW%$&+37h8W:>HsBg'2[73?N@ACFjA !+,/'346$:6>>?AE?e i%',0n386|<`(3}6<7=ADF::=t@7o!/4j"(*E,A01y268V:?H2w d$(/*3 :=dACaF 19|Q"$P%) 2857=+F$GT/x;"&s')3.[;K@sBH&-#Y$'-*45};C ,- #!#&g ,.04>?AG4*!r'*Y,H'C %Y(8)+27?@B2CG$7!'%H'+4m5:g="0158O;K<>BD< !<$f,.;?@CA Em "%)'+.8E:3<@5ADG %A',0355:J;>IAPI#&)+D+-/12b5d9 A$CT_5$s&*(-n.04B79=1 CwE/ #U%)-.0#'%+/93v6^:@!I"&H*Q/-4?6<^= DG  R[ +,/4M>H ]8 &)-d/> 69?j F F(o"}`m$x\: !Z/ WI9< UR P0dDOLM !4JP-@OR)LMSL \J05I%DW,2B #&3A q <` $++/`1:$z(1u59#0i7o,u4jAE1? CJ-%8<$7-S1 ;=$ 6X:@B ] !}D`m$Programmer'sAssistantFunctionsuser.=isequivalentto=innity.isinitially.[Function]performsthenecessaryhousekeepingoperationstomakebetranslatedtotheundoableversionwhentyped-in.Forexample,canbemadeundoablewhentyped-inbyperforming:[Function]performsthesubstitutionoffunctionsfordestructivefunctionsthataretyped-in.Ifisnot,itisthenameofafunction,andisitsargumentlist.Ifis,isaform.Inbothcases,returnswiththeappropriatesubstitutions.isalistofboundvariables(optional).incorporatesinformationaboutthesyntaxandsemanticsofInterlispexpressions.Forexample,itdoesnotbothertomakeundoableoperationsinvolvingvariablesboundin.Itdoesnotperformsubstitutioninsideofexpressionsofwhichisannlambdafunction(unlessoftheformhasthepropertyvalue,seepage5.4).Forexample,typedto,willbreakon,not.Similarly,substitutionbeperformedintheargumentsforfunctionslike,,etc.,sincethesecontainexpressionsthatwillbeevaluatedorapplied.Forexample,iftheusertypesthemustbereplacedby.[Function]isaneventspecication.isthefunctionthatexecutescommandsbycallingontheappropriateentry(s).[Function]Undoesoneevent.returnsifthereisnothingtobeundone.Iftheeventisalreadyundone,printsandreturns.Otherwise,undoestheevent,printsamessage,e.g.,,andreturns.If=andtheeventisalreadyundone,orisanundocommand,takesnoactionandreturns.usesthisoptiontosearchforthelasteventtoundo.Thuswhen=,simplysearcheshistoryuntilitndsaneventforwhichreturns.Undoinganeventconsistsofmappingdown(of)thepropertyvaluefor,andforeachelement,applyingto,andthenmarkingtheeventundonebyattaching(with)atothefrontofitsproperty.Notethattheundoingofeachelementonthepropertywillusuallycauseundosavestobeaddedtothe,therebyenablingtheeectsoftobeundone.8.34#UNDOSAVESNIL#UNDOSAVES#UNDOSAVESNIL(NEW/FN)NEW/FN/RADIX_(DEFINEQ(/RADIX(X)(UNDOSAVE(LIST'/RADIX(RADIXX))(/RADIX)_(NEW/FN'RADIX)(LISPX/)LISPX//NILNILLISPX/LISPX/CARCARINFOEVAL(BREAKPUTD)LISPXPUTD/PUTDshouldMAPCRPTQ(MAPC'(FOO1FOO2FOO3)'PUTD)PUTD/PUTD(UNDOLISPX)UNDOLISPXUNDOUNDOLISPX1(UNDOLISPX1)UNDOLISPX1NILUNDOLISPX1ALREADYUNDONETUNDOLISPX1SETQUNDONETTUNDOLISPX1NILUNDOLISPXNILUNDOLISPXUNDOLISPX1TCDRSIDECARCDR/ATTACHNILSIDESIDEcurrentLISPXHISTUNDOLISPX1FNFNFNXFNVARSFNXFNXXVARSXLINELINEEVENTFLG_FLGLINE|b'g ((. x\:#( )z 0):CZ WC5 U%"%9+7 3 :V;AC TDk!)-146AyDF!R![%$&( GC5 E/"%W ,/57 >DGDWo!I"'({)+3-1D249=?UA*GJBmf!#%$W(Z*1-t6<@B A  #%&H(*;.4H > % -o14K8;BaDi<` T!'(+.2Z37t=V C:M!$ $&A)`+1 8j H&9$T)1"258R:<F77o!4$d&77:@ADG5"# *F 6%8*>@C54# &E*+.295: B6E#G2~ '&w)m/1E3730"?(}+-3P9~-C5 ,--" 35G7=k@_* -/2, 9'C5 %-46s:;@BD$7: G" '76BG(" -2A48A%D) *.Q02j57=hCGN $)8+-1L69l> AH0X/-.m3X8;(?L SB(o!}|`m$ x\:3 $1 @ Z W TUTD&<OT 'M (t-47:LMJT G E.qDW%B1G>:E+9.1Bo7o,2<5~{1x4#"'C2~;@E0$5J- ,-+wE*$ ' %$ 1$7, :A?"H$ E $@ @)&,/3-+ 93EJ+&/#*+@9-{{X!{x&@ }|`m$xWU?TD'G\DW<B0 L;A  :#5-*,-'U+{"}D4`m$R88THEPROGRAMMER'SASSISTANT[Function]isaneventspecication.printstheeventsonspeciedby,e.g.,.Printingisperformedviathefunction,sothatifthevalueof=,eventswillbeprettyprinted.isan(optional)functionalargumentthatisappliedtoeacheventbeforeprinting.Ifitreturnsnon-,theeventisskipped,i.e.,notprinted.If=,orappliedtothecorrespondingeventistrue,thevalueisnotprinted.Forexample,iswhenprintingeventson.Forexample,thefollowingwilldeneasacommandforprintingthehistorylistwhileskippingall``largeevents''andnotprintinganyvalues.8.8THEEDITORANDTHEPROGRAMMER'SASSISTANTAsmentionedearlier,alloftheremarksconcerning``theprogrammer'sassistant''applyequallywelltouserinteractionswith,ortheeditor.Thedierencesbetweentheeditor'simplementationofthesefeaturesandthatofaremostlyobviousorinconsequential.However,forcompleteness,thissectiondiscussestheeditor'simplementationoftheprogrammer'sassistant.Theeditorusestoprintitspromptcharacter,and,,andforobtaininginputs.Whentheeditorisgivenaninput,itcallstorecordtheinputinaneweventonitshistorylist,.followsthesameconventionsandformatas.However,sinceeditcommandshavenovalue,theeditorusesthevalueeldforsavingsideeects,ratherthanstoringthemundertheproperty.Theeditorrecognizesandprocessesthefourcommands,,,andwhichrefertopreviouseventson.Theeditoralsoprocessesitself,asdescribedbelow.AllotherhistoryExceptthattheatomiccommands,,,,,andarenotrecorded.Inaddition,numbercommandsaregroupedtogetherinasingleevent.Forexample,isconsideredasonecommandforchangingposition.8.35(PRINTHISTORY)PRINTHISTORY(-1THRU-10)SHOWPRIN2SYSPRETTYFLGTNILTTEDITHISTORYLISPXMACRO??'(??'(PRINTHISTORYLISPXHISTORYLISPXLINE(FUNCTION(LAMBDA(X)(IGREATERP(COUNT(CARX))5)))TT))EVALQTBREAKLISPXPROMPTCHARLISPXREADLISPXREADPREADLINEHISTORYSAVEEDITHISTORYEDITHISTORYLISPXHISTORYSIDEDO!E!F!NEDITHISTORYUNDOOKSTOPSAVEP?PPE33-1HISTORYLINESKIPFNNOVALUESFILELINEHISTORYLINESKIPFNNOVALUESNOVALUESNOVALUESy , I !}`m$|b'!= -x[C5 ZR<" 6:=gAX#.$3 5;=tDGW$&(!+/,/p3Y?hABG4Ua R\* / & -(3c6E7<>AEPg <$*/+ -h127:<M!"+025l >BnD GL L &=)06z9=CYGJf G` #525=?A GE$z&*027<.?AG?D|0 i ,}x+  ~#D *Y-| 6I o/ "'Z,.M8>A0 &  #B '), 4 #  k#%+ 1<^EG(" $[p"-$()-/}3y4AC8G c  ZGX>+7<]>BN   "#'s*814d6n:s<@CF7  ?sI"&*.0r9d    #W&/6145:?B~DSl ;z!$v.2R4:W?0AEP 8-U" &m*,.16V8;nB$D ] &z#h%&&b*\.1=> EuG4 GZ(o}`m$x[ .ZR+ X()+{/0W]5S @P'M! L 8/Jf G`)| 9A ?j6 =6<6'.V:y! *058k867-6)(Y# 4= " 7 c"} -  6-0:28{lY * ]#'s+-/4 ]7f9:;}@`m$x[ $&'Q(, ZRDHX TR\MX e$&'X(L /Y1"13f ;=$!}L`m$P99TheEditorandtheProgrammer'sAssistantcommandsaresimplygiventoforexecution,afterrstbinding(resetting)to.Theeditoralsocallswhengivenancommand(page17.45).Inthiscase,theeditorusesthefthargumentto,,tospecifythatanyhistorycommandsaretobeexecutedbyarecursivecallto,ratherthanbyunreading.Forexample,iftheusertypesintheeditor,hewantsthelasteventonprocessedasinput,andnottobeunreadandprocessedbytheeditor.Themajorimplementationdierencebetweentheeditorandoccursinundoing.isalistofonlythelastcommands,whereisthevalueofthetime-slice.Howevertheeditorprovidesforundoingchangesmadeinasingleeditingsession,evenifthatsessionconsistedofmorethaneditcommands.Therefore,theeditorsavesundoinformationindependentlyoftheonalistcalled,(althoughitalsostoreseachentryonintheeldofthecorrespondingeventon.)Thus,thecommands,,and,arenotdependenton,andinfactwillworkif=,oreveninasystemwhichdoesnotcontainatall.Forexample,speciesundoingthelastcommandon,evenifthateventnolongerappearson.Theonlyinteractionbetweenandthehistorylistoccurswhentheusertypesfollowedbyaneventspecication.Inthiscase,theeditorcallstondtheevent,andthenundoesthecorrespondingentryon.Thustheusercanonlyundoacommandwithinthescopeofthe.(Notethatthisisalsotheonlywaycommandsthemselvescanbeundone,thatis,byusingthehistoryfeature,tospecifythecorrespondingevent,e.g.,.)Theimplementationoftheactualundoingissimilartothewayitisdonein:eachcommandthatmakesachangeinthestructurebeingediteddoessoviaafunctionthatrecordsthechangeonavariable.Afterthecommandhascompleted,thisvariablecontainsalistofallthepointersthathavebeenchangedandtheiroriginalcontents.Undoingthatcommandsimplyinvolvesmappingdownthatlistandrestoringthepointers.asindicatedbytheirappearanceon,alistofthehistorycommands.in-terrogatesbeforeattemptingspellingcorrection.(Allofthecommandsonarealsoonandsothattheycanbecorrectedifmisspelledintheeditor.)Thusiftheuserdenesaandwishesittooperateintheeditoraswell,heneedsimplyadditto.Forexample,isimplementedasaandworksequallywellinandtheeditor.8.36LISPXLISPXHISTORYEDITHISTORYLISPXELISPXLISPXEREDOLISPXHISTORYLISPXLISPXEDITHISTORYallEDITHISTORYUNDOLSTUNDOLSTEDITHISTORYUNDO!UNDOUNBLOCKEDITHISTORYEDITHISTORYNILLISPXUNDOUNDOLSTEDITHISTORYUNDOUNDOLISPXFINDUNDOLSTspeciedEDITHISTORYUNDOUNDOUNDOLISPXHISTORYCOMSEDITDEFAULTHISTORYCOMSHISTORYCOMSEDITCOMSAEDITCOMSLLISPXMACROHISTORYCOMSRETRIEVELISPXMACROLISPXLISPXFLGNNNy\G !}`m$|b'h#&:( 1Vx\: t]#"% +.16 H0Z*%)-@07:?A|D*GX AK#\*F+R-/147<CFGWI x !%(* 14]:$;}=@U   g ,y28<?hAC_E9S  3P    &](,428v:%OR  O pTc &5')-/=1487>@\DSM  ;#(v-~02I5)9?AE:L  m =!%e) 0 9;GJa  \7N"x&[)-%57M9<>@ H  :!R+02:;>L@GG*>+"-]1A2V4P79;?DGjEp x |"#)%.03`9ABtEGC  u#$'>*? 0:<?CwEB$   D"I$C( 0k2D48@:>@   ", +'.67;&=@C)FL> {0!o#3./369?:=?C=3  `[!$&e(k,.38)9>@ ;  d8  =#%X)+{-013W6<=@G6 2jh!$%C(e*,K-h25:U<A>C7DT5=  ' "#'M,-/135;"=A!Ds3   i#*)z-3#8<?LA}D(1  Is  + T}R})*+-/2 369G  7"$')+-i03q57_9>*m  3#%b($+&-/1b5x6 =v?AkFb  V o"X&().0y268;=AQEH h }%'*o/k1#;N>BF Pb(o!}`m$x\:= Z /=X(WIDOEU! 47P/w@ {MxL= JaU/0H (^,4G $ .Ep;C| 6PB$A@0{> !x% E;88hs =  @ m  h W2W  }d`m$xX$h)^OR/$MHq =$ } , `m$" TIMESROMANGACHACMS CMR  CMI   TIMESROMAN  TIMESROMAN CMSYZ  * 4 = F R \ |g r }>tj j F  v p*" + 4 *> rGO Yj/\%Zh ChapPA.PRESSSANNELLASEPTEMBER 15, 1983 11:41:44