€stload  filename €let  f fopen  filename r€€ l1 m2read  f €€ l2 fclose  f €€€ l1 €€ State þ filename þState þfilename þstsave  filename  State €let  f fopen  filename w€€ l1 m2write  f  State €€€fclose  f €€€ l4 þ l3 þ l2 þ l1 þl4 þl3 þl2 þl1 þedit  s €if is SYM  s €let  f fopen _tmp1w€€ l1 fputs strcat symstr  s € <- € f €€ l2 nwrite  f eval  s €€€ l3 fputs  ;  f €€ l4 fclose  f €€€vi _tmp1€€ use: (edit 'object) €€ simb þHelpDir þsimb þhelp  simb €if is SYM  simb €sh strcat _EDITOR -R "+/N : symstr  simb €/" HelpDir nyag.hlp€€ use: (help 'func) €€types þset  x from  x oblist equal type eval  x €€quote TYPE €€€€€sig þnwrite stdout _ops €€ x20 þ x19 þ f1 þx20 þx19 þf1 þ_l1 þtest þprogn def _l1 lerstr "." to end ? €€while nequal _l1 .€let  f1 fopen _tmp1w€€ x19 fputs _l1  f1 €€ x20 fclose  f1 €€ x sh seca _tmp1 _tmp€€€if equal  x €let  f fopen _tmpr€€ x1 pp m2read  f €€€€fclose  f €€princ error, try again ... €€€def _l1 lerstr ? €€€€€cat  f €sh strcat _MORE  f €€€cat. þcat FILENAME €€FILENAME þvi. þvi FILENAME €€vi  f €progn sh strcat _EDITOR _FILENAME €€nload  f €€€_MORE more < run  m €while let  x menu  m €€€if nequal  x €progn pp  x €true €false €€€€ acc þacc þmenu  m €let  m1 opcoes_list  m €€ a1 progn princ  --------------------------------------------------€princ  titger  m € €set princ  x  titopc el  x  m1 €€ €from  x inds  m1 €€€def _b leropcao  qual a opcao? €€while or gt _b length  m1 €€lt _b €€def _b leropcao qual a opcao? €€€princ  -------------------------------------------------- €€€ acc if nequal _b €accao_op el _b  m1 €€_b €€€cond equal quote SYM €type  acc €€eval  acc €€€is tmenu  acc €menu  acc €€equal quote LIST €type  acc €€eval  acc €€equal quote INT €type  acc €€ acc €true  acc €€€€_exp taccao accao_op titopc opcoes opcoes_list titger tmenu  valor þvalor þfpp  valor €nwrite stdout  valor €€ e þe þlerfixdomff  e €ff1 list  x lerany  x €€from  x  e €€€ p þp þlerany  p €progn ppn  p €read €€€ s þs þppickone  m1  s €let  m cond equal quote SET €type  m1 €€seq  x from  x  m1 €€€equal quote LIST €type  m1 €€ m1 €equal quote FF €type  m1 €€seq makeff  x ap  m1  x €€€from  x dom  m1 €€€€€€ a1 progn princ  -------------------------------------------------- €set princ  x  el  x  m € €from  x inds  m €€€def _b leropcao strcat   s €€€while or gt _b length  m €€lt _b €€def _b leropcao strcat   s €€€€princ  -------------------------------------------------- €€€€if equal _b €NIL el _b  m €€€€pickmany  m1 €let  m cond equal quote SET €type  m1 €€seq  x from  x  m1 €€€equal quote LIST €type  m1 €€ m1 €equal quote FF €type  m1 €€seq makeff  x ap  m1  x €€€from  x dom  m1 €€€€€€ a1 progn princ  -------------------------------------------------- €set princ  x  el  x  m € €from  x inds  m €€€€€€set el  b  m €from  b lerset  quais destes (. para terminar) ? €€€€€ m1 þleropcao  x €let  a lerstr  x €€€if equal  a  €atoi  a €€€€_b þm1 þpickone  m1 €let  m cond equal quote SET €type  m1 €€seq  x from  x  m1 €€€equal quote LIST €type  m1 €€ m1 €equal quote FF €type  m1 €€seq makeff  x ap  m1  x €€€from  x dom  m1 €€€€€€ a1 progn princ  -------------------------------------------------- €set princ  x  el  x  m € €from  x inds  m €€€def _b leropcao  qual destes ? €€while or gt _b length  m €€lt _b €€def _b leropcao qual destes ? €€€princ  -------------------------------------------------- €€€€if equal _b €NIL el _b  m €€€€lerset  str €progn ppn  str €let  a read €€€if equal  a FIM €makeset €union makeset  a €lerset ? €€€€€€. þFIM . lersetstr  str €progn ppn  str €let  a lerstr ?- €€€if equal  a .€makeset €union makeset  a €lersetstr  €€€€€€lerint  str €progn ppn  str €let  a read €€€if equal type  a €quote INT €€ a lerint  str €€€€€ str þ_l  y €let  z strlen  y €€€substr  y sub  z €€€€str þlerstr  str €progn ppn  str €let  a fgets €€€if equal  a  €_l fgets €€_l  a €€€€€or2  x  y €cond equal  x makeset €€ y €equal  x false € y €is NIL  x € y €true  x €€€ e2 þ e1 þ nome þe2 þe1 þnome þ_ok  nome  e1  e2 €cond equal  e1  e2 €pp strcat ok  nome €€€true pp strcat ERRO:  nome €€€€€id  x € x €in_  t  val €let  t1 gettype  t €€ m hd  t1 €€€cond and equal  m quote TUP €€is LIST ANY  val €€tup2arg  t  val €€equal  m quote TUP €€tup2arg  t makeseq  val €€€equal  m quote ALT €€p2  val €€true makeseq quote Erro € m  t1  val €€€€€_in_  x €curry in_ € x €€_out_  x €curry out_ € x €€ m þ t1 þ val þErro þm þt1 þval þout_  t  val €let  t1 gettype  t €€ m hd  t1 €€€cond and equal  m quote TUP €€equal length  t1 €€€p1  val €€equal  m quote TUP €€ignlab  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€and equal  m quote ALT €€is ap  t1 € val €€makeseq  val €€true makeseq quote Erro € m  t1  val €€€€€ssum  l €fadd  l €€seither  l €cotup  l €€isx  x  a €equal p1  a € x €€ix  x  a €makeseq  x  a €€sprod  l €fprod  l €€ l þl þssplit  l €tup  l €€prod  f  g €split comp  f p1 €comp  g p2 €€€split  f  g €lambda  x €makeseq quote  f € x €quote  g € x €€€€sum  f  g €either comp i1  f €comp i2  g €€€ t þt þeither  f  g €lambda  x €let  t p1  x €€ y p2  x €€€if equal  t €quote  f € y €quote  g € y €€€€€is2  x €equal p1  x €€€is1  x €equal p1  x €€€i2  b €makeseq  b €€i1  a €makeseq  a €€curry  f €lambda  a €lambda  b €quote  f € a  b €€€€_fflr  f  g €comp _ffl  f €_ffr  g €€€comp  f  g €lambda  x € f  g  x €€€€_ffr  f €cond equal _noa  f €€lambda  g €cond is FF ANY ANY  g €ff1 list  x  f ap  g  x €€€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1 €cond is FF ANY ANY  g €ff1 list  x  f ap  g  x € a1 €€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1  a2 €cond is FF ANY ANY  g €ff1 list  x  f ap  g  x € a1  a2 €€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1  a2  a3 €cond is FF ANY ANY  g €ff1 list  x  f ap  g  x € a1  a2  a3 €€from  x dom  g €€€€€€€€€_ffl  f €cond equal _noa  f €€lambda  g €cond is FF ANY ANY  g €ff1 list eval makeseq quote  f €quote  x €€€ap  g  x €€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1 €cond is FF ANY ANY  g €ff1 list eval makeseq quote  f €quote  x €quote  a1 €€€ap  g  x €€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1  a2 €cond is FF ANY ANY  g €ff1 list eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €€€ap  g  x €€from  x dom  g €€€€€€€equal _noa  f €€lambda  g  a1  a2  a3 €cond is FF ANY ANY  g €ff1 list eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €quote  a3 €€€ap  g  x €€from  x dom  g €€€€€€€€€_seq  f €cond equal _noa  f €€lambda  g €cond is LIST ANY  g €seq eval makeseq quote  f €quote  x €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1 €cond is LIST ANY  g €seq eval makeseq quote  f €quote  x €quote  a1 €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1  a2 €cond is LIST ANY  g €seq eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1  a2  a3 €cond is LIST ANY  g €seq eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €quote  a3 €€€from  x  g €€€€€€€€ a3 þ a2 þ a1 þ g þa3 þa2 þa1 þg þ_set  f €cond equal _noa  f €€lambda  g €cond is SET ANY  g €set eval makeseq quote  f €quote  x €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1 €cond is SET ANY  g €set eval makeseq quote  f €quote  x €quote  a1 €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1  a2 €cond is SET ANY  g €set eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €€€from  x  g €€€€€€equal _noa  f €€lambda  g  a1  a2  a3 €cond is SET ANY  g €set eval makeseq quote  f €quote  x €quote  a1 €quote  a2 €quote  a3 €€€from  x  g €€€€€€€€_noa  f €cond equal type  f €quote FUN €€length head  f €€€true €€€tup  y €lambda  x €seq  f  x €from  f quote  y €€€€€ i þi þzip  x  y €seq makeseq ap  x  i €ap  y  i €€from  i inseg length  x €€€€€cotup  y1 €lambda  x €let  y quote  y1 €€€cond and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x €€€let  z p2  x €€€ap  y € z €€€and not null  x €€equal p1  x € €€let  z p2  x €€€ap  y  € z €€€and not null  x €€equal p1  x € €€let  z p2  x €€€ap  y  € z €€€€€€€fadd  y1 €lambda  x €let  y quote  y1 €€€cond and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x €€€let  z p2  x €€€makeseq ap  y € z €€€€and not null  x €€equal p1  x € €€let  z p2  x €€€makeseq  ap  y  € z €€€€and not null  x €€equal p1  x € €€let  z p2  x €€€makeseq  ap  y  € z €€€€€€€€ xl þ x1 þ yl þ y1 þxl þx1 þyl þy1 þ_fprod  x  y €cond and not null  y €€is LIST ANY  y €€let  y1 hd  y €€ yl tl  y €€€cond and not null ignlab  x €€€is LIST ANY ignlab  x €€€let  x1 hd ignlab  x €€€ xl tl ignlab  x €€€€cons  y1  x1 €_fprod  xl  yl €€€€€€€null  y €makeseq €€€€fprod  y €lambda  x €_fprod  x quote  y €€€€ __ þ comm þ o þ com þ__ þtostr  x €cond is STR  x € x €is SYM  x €symstr  x €€is INT  x €itoa  x €€€€comm þo þcom þgetas  com  o €let  comm strcat strcat  com  | any2sexp €reduce strcat seq strcat strcat strcat strcat  -tostr  x €€="€tostr ap  o  x €€€"€from  x dom  o €€€€€€ a popen  comm r€€ b readf  a €€ __ pclose  a €€€ b €€_ops getas ANY ANY €NIL €€ f þf þsort2  f  x €cond null  x € x €and not null  x €€is SET ANY  x €€let  H choice  x €€ T difference  x makeset  H €€€€sort2  f seq  z from  z  x €€€€€lt length  x €€ x €and not null  x €€is LIST ANY  x €€let  H hd  x €€ T tl  x €€€let  a sort2  f seq  y from  y  T lt  f  y  H €€€€€€ b sort2  f seq  y from  y  T geq  f  y  H €€€€€€€append append  a makeseq  H €€ b €€€€€€ b þ y þ a þ z þ T þ H þ x þb þy þa þz þT þH þx þsort  x €cond null  x € x €and not null  x €€is SET ANY  x €€let  H choice  x €€ T difference  x makeset  H €€€€sort seq  z from  z  x €€€€€lt length  x €€ x €and not null  x €€is LIST ANY  x €€let  H hd  x €€ T tl  x €€€let  a sort seq  y from  y  T lt  y  H €€€€€ b sort seq  y from  y  T geq  y  H €€€€€€append append  a makeseq  H €€ b €€€€€€nload  f €progn sh strcat seca  f  _tmp€€load _tmp€€€_EDITOR vi _FILENAME þed þprogn cond null _FILENAME €def _FILENAME _untitled€€€cond null _EDITOR €def _EDITOR vi €€€sh strcat _EDITOR _FILENAME €€nload _FILENAME €€€arg2tup tup2arg bless ops stload stsave edit help cat types sig test cat. vi. vi run menu leropcao fpp lerfixdomff lerany ppickone pickmany pickone lerset lersetstr lerint _l lerstr or2 _ok id in_ _in_ _out_ out_ ssum seither isx ix sprod ssplit prod split sum either is2 is1 i2 i1 curry _fflr comp _ffr _ffl _seq _set _noa tup zip cotup fadd _fprod fprod tostr getas nload sort2 sort ed €obs _MORE _EDITOR FIM _ops ops obs €€_exp ë taccao êtmenu  _exp € tmenu ètitger opcoes_list opcoes € opcoes étitopc accao_op taccao €€