UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

An interactive debugging package for lisp/mts Friedman, Paul 1973

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Notice for Google Chrome users:
If you are having trouble viewing or searching the PDF with Google Chrome, please download it here instead.

Item Metadata

Download

Media
831-UBC_1973_A6_7 F75_3.pdf [ 3.77MB ]
Metadata
JSON: 831-1.0052013.json
JSON-LD: 831-1.0052013-ld.json
RDF/XML (Pretty): 831-1.0052013-rdf.xml
RDF/JSON: 831-1.0052013-rdf.json
Turtle: 831-1.0052013-turtle.txt
N-Triples: 831-1.0052013-rdf-ntriples.txt
Original Record: 831-1.0052013-source.json
Full Text
831-1.0052013-fulltext.txt
Citation
831-1.0052013.ris

Full Text

AN INTERACTIVE DEBUGGING PACKAGE FOR LISE/MTS by PAUL FRIEDMAN B. S. U n i v e r s i t y of C a l i f o r n i a I r v i n e A THESIS SUBMITTED IN PARTIAL FULFILMENT CF THE REQUIREMENT FOB THE DEGREE OF MASTER OF SCIENCE i n the Department of COMPUTER SCIENCE We accept t h i s t h e s i s as conforming t o the r e q u i r e d standard. THE UNIVERSITY OF BRITISH COLUMBIA 10-03-73 In p r e s e n t i n g t h i s t h e s i s i n p a r t i a l f u l f i l m e n t o f the requirements f o r an advanced degree a t the U n i v e r s i t y o f B r i t i s h Columbia, I agree t h a t the L i b r a r y s h a l l make i t f r e e l y a v a i l a b l e f o r r e f e r e n c e and study. I f u r t h e r agree t h a t p e r m i s s i o n f o r e x t e n s i v e c o p y i n g o f t h i s t h e s i s f o r s c h o l a r l y purposes may be granted by the Head of my Department or by h i s r e p r e s e n t a t i v e s . I t i s understood t h a t c o p y i n g or p u b l i c a t i o n o f t h i s t h e s i s f o r f i n a n c i a l g a i n s h a l l not be allowed without my w r i t t e n p e r m i s s i o n . Department o f mmpni-P.r SHsnrp The U n i v e r s i t y o f B r i t i s h Columbia Vancouver 8, Canada Date October 5. 1973 i ABSTRACT Most l a r g e a r t i f i c i a l i n t e l l i g e n c e programs are w r i t t e n i n LISP. These systems are g e n e r a l l y so complex, that a t any given p o i n t , the programmer h i m s e l f cannot t e l l what the system i s doing, To work with these systems, the programmer must he able to take an a c t i v e r o l e i n the program's e x e c u t i o n . T h i s means, he must be ahle to monitor the program's e v a l u a t i o n , watch f o r i n c o r r e c t data g e n e r a t i o n , and be n o t i f i e d when program e r r o r s occur. T h i s r e q u i r e s a t r u l y i n t e r a c t i v e language. T h i s t h e s i s presents a LISP program which c o n v e r t s LISP to an i n t e r a c t i v e language. The model f o r t h i s system i s the BBN-LISP programming system. Included here i s a LISP e d i t o r and BREAK and ERROR packages. Through f u n c t i o n c a l l s and commands, the user i s put i n f u l l c o n t r o l over the execution of h i s program and can c o r r e c t e r r o r s while i n LISP. i i TABLE OF CONTENTS EDITOR . .....2 COMMANDS THAT CHANGE THE EDITOR *S ATTENTION 3 n,-n,0 3 UP « 5 I 6 !0 - . 7 NX,BK ...........8 !NX 9 F , .....10 COMMANDS WHICH CHANGE THE EDITED STRUCTURE ,.11 INSERT,I --12 DELETE, D ..13 EMBED, EM 14 EXTRACT, EX .15 COMANDS THAT "MOVE PARENTHESES" ...16 ML,MR ..17 B l 18 BO 19 COMMANDS THAT UNDO 20 ?? , 21 UNDO .....22 •UNDO .........23 TEST,UNBLOCK ...21 COMMANDS THAT PRINT ..25 P,?,PP .........25 -.P ..26 MISCELLANEOUS COMMANDS 27 S 27 E 27 OK 27 HELP ..27 DEFAULTS .....28 A SAMPLE EDITING RUN .....29 EDITOR FUNCTIONS 34 EDITOR INTERNAL FUNCTIONS ,.35 DEBUGGING FACILITIES 37 WHAT YOU CAN DO IN A BREAK 39 GO 39 OK 39 EVAL ..39 RETURN ..39 FROM ., 39 USE 39 | 40 II »<> ARGS ....40 HELP .......40 CONTEXT COMMANDS .....41 F .., ...........41 TOP 42 EDIT ..42 AT .... ....42 FROM 42 BACKTRACE COMMANDS 43 BKF .43 i i i BKE 43 BK .....43 BREAK PACKAGE 44 BREAKF .......44 TRACE 44 UNBBEAK 44 UNTBACE 45 BREAKO 46 ERROR PACKAGE ..47 BREAK PACKAGE COMMAND SUMMARY ...48 A SAMPLE DEBUGGING SESSION 50 BREAKPACKAGE INTERNAL FUNCTIONS 58 PRETTYPRINTING AND PROGRAM FILES 60 PRETTIPRINT ....60 DSKIN 60 DSKOUT ..............60 UPDATE ..,.61 BIBLIOGRAPHY ..62 APPENDEX .....63 1 INTRODUCTION W r i t i n g and debugging LISP programs can e i t h e r be a dream or nightmare. The LISP language c o n t a i n s both a i d s ( i t s f u n c t i o n a l nature, the f a c t t h a t programs are data) and o b s t a c l e s (the "parentheses matching" problem and the ease i n which the programmer can c r e a t e r e c u r s i v e r a t s ' nests) to good programming. Presented here i s a c o l l e c t i o n o f LISP f u n c t i o n s which, together, c r e a t e a more f r i e n d l y environment f o r programming. The READ-EVAL-PRINT loop i n LISP i s a c t u a l l y a f a s t turnaround batch system which, by i t s e l f , p r o v i d e s very l i t t l e i n the way of debugging a i d s . I f no LISP e r r o r s occur, than a value i s p r i n t e d , which may be c o r r e c t or i n c o r r e c t (of course, s i d e e f f e c t s may o c c u r ) . I f the value i s i n c o r r e c t , the progammer i s l e f t pondering over h i s l i s t i n g s , or i n s e r t i n g c a l l s t o PRINT i n the program f i l e , a l t e r i n g and r e r e a d i n g s - e x p r e s s i o n s , and t r y i n g again. I f LISP e r r o r s do occur, a ( g e n e r a l l y unreadable) backtrace of f u n c t i o n c a l l s i s p r i n t e d . Since LISP i s executed i n t e r p r e t i v e l y , much i n f o r m a t i o n can be gathered d u r i n g the e v a l u a t i o n of LISP f u n c t i o n s . A l s o , s i n c e LISP f u n c t i o n s are themselves l i s t s t r u c t u r e s , they can be changed to pr o v i d e even more i n f o r m a t i o n about the execution of the program. The f u n c t i o n s presented here ( f o l l o w i n g the BBN-LISP 3 model , the break package documentation i s from UCH) attempt to make LISP a t r u l y i n t e r a c t i v e programming language by a l l o w i n g the user to take c o r r e c t i v e a c t i o n when LISP e r r o r s are detected and to monitor the e v a l u a t i o n of (user) s e l e c t e d f u n c t i o n s . When e r r o r s are detected ( e i t h e r by the i n t e r p r e t e r or the u s e r ) , the f u n c t i o n d e f i n i t i o n s may be changed (within LISP) and execution c o n t i n u e d . The parentheses problem, which new LISP users complain about so much i s eased, with a p r e t t y p r i n t e r (a f u n c t i o n which p r i n t s LISP s t r u c t u r e s i n an indented form) and by the f a c t t h a t i t i s harder to make parentheses e r r o r s i n s i d e LISP because, once the parentheses match, i t i s i m p o s s i b l e f o r them to be made not to match. No amount of "programming a i d s " w i l l cushion the blow of l e a r n i n g LISP. I t i s very d i f f e r e n t than most other languages. Most new users tend to w r i t e FORTRAN or ALGOL-like LISP programs missing many of the advantages of the LISP language. S i m i l a r l y , users accustomed to a batch type language (as most a r e ) , sometimes f i n d i t d i f f i c u l t to c o n v e r t to a t r u l y i n t e r a c t i v e one. Consequently, many LISP users s t i l l run i n the e s s e n t i a l l y batch READ-EVAL-PRINT mode, not t a k i n g advantage of the debugging a i d s p o s s i b l e . Such users are encouraged to experiment with the debugging package d e s c r i b e d i n t h i s manual, i f only to d i s c o v e r f o r themselves the power, f l e x i b i l i t y and elegance of a genuinely i n t e r a c t i v e LISP system. 2 ft L I S P EDITOB INTRODUCTION The power o f L I S P 2 3 * a s an i n t e r a c t i v e l a n g u a g e i s r e d u c e d when t h e u s e r i s u n a b l e t o change h i s program w h i l e i n t h e LISP e n v i r o n m e n t . F o r t h i s r e a s o n , many LI S P e d i t o r s have been w r i t t e n , i n c l u d i n g one a t BBN. The BBN L I S P e d i t o r * 3 has t h e a d v a n t a g e o f b e i n g b o t h s i m p l e t o use and v e r y p o w e r f u l . I t has t h e d i s a d v a n t a g e o f b e i n g v e r y l a r g e . The e d i t o r p r e s e n t e d h e r e i s a somewhat s c a l e d - d o w n v e r s i o n o f t h e BBN e d i t o r , w h i c h w i t h t h e p r e t t y p r i n t e r , r e q u i r e s 1 0 pages o f memory. The e d i t o r i s w r i t t e n i n LISP/MTS*. The e d i t o r o p e r a t e s by b e i n g c a l l e d by one o f two t o p l e v e l f u n c t i o n s . F o r e x ample, t o e d i t f u n c t i o n d e f i n i t i o n s , one u s e s (EDITF FOO F I E ) where F00 and F I E a r e t h e f u n c t i o n s t o be e d i t e d . The o t h e r t o p l e v e l f u n c t i o n i s EDITE. EDITE e v a l u a t e s i t s argument p a s s i n g i t t o t h e e d i t o r . Once i n t h e e d i t o r , t h e u s e r d i r e c t s o p e r a t i o n s t h r o u g h commands. T h e s e commands f a l l i n t o t h r e e b r o a d c l a s s e s , t h o s e which change t h e e d i t o r ' s a t t e n t i o n , t h o s e which a c t u a l l y m o d i f y t h e s t r u c t u r e b e i n g e d i t e d , and m i s c e l l a n e o u s commands. 3 COMMANDS THAT CHANGE THE EDITOR'S ATTENTION I n any e d i t o r , t h e r e must be a way t o s p e c i f y where c h a n g e s a r e t o be made. I n t h e MTS e d i t o r , t h i s i s done b o t h by t h e use o f l i n e numbers, and by s e a r c h i n g f o r s t r i n g s . S i n c e t h e r e a r e no l i n e s i n a LIS P s t r u c t u r e , t h e commands h e r e w i l l need t o s p e c i f y by s t r u c t u r a l c o n t e x t where t o l o o k . The r e a d e r i s r e m i n d e d t h a t what i s t y p e d t o t h e f u n c t i o n (READ) and what he i s r e t u r n e d from (PRINT) does n ot e x i s t as a c h a r a c t e r s t r i n g i n memory. T h e r e i s no (A B C D) i n s i d e L I S P , b u t r a t h e r s o m e t h i n g more l i k e A | — | I I >l B 1 1 I i — I > J When t h e u s e r t y p e s (EDITF F 0 0 ) , t h e e d i t o r ' s a t t e n t i o n i s on t h e l i s t s t r u c t u r e o f t h e f u n c t i o n F00. At any t i m e , t h e e d i t o r ' s a t t e n t i o n w i l l be on some s u b s t r u c t u r e o f t h e f u n c t i o n F00. T h i s s u b s t r u c t u r e w i l l h e r e a f t e r be c a l l e d t h e c u r r e n t , e x p r e s s i o n , and when we s a y t h a t t h e c u r r e n t e x p r e s s i o n i s ch a n g e d , we mean t h a t t h e e d i t o r i s l o o k i n g somewhere e l s e , NOT THAT THE STRUCTURE OF THE FUNCTION IS CHANGED. The c u r r e n t e x p r e s s i o n c a n a l w a y s be s e e n by t y p i n g t h e command ? .*Now, s u p p o s e , a t t h e t o p l e v e l o f L I S P , we e n t e r * (DEFON F00 (X) * (COND ( (NULL X) NIL) * (T (CONS X X ) ) ) ) > F00 * (EDITF FOO) :EDITING FOO : (LAMBDA (X) (COND & 6) .? :LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) The i n p u t p r e f i x c h a r a c t e r f o r t h e e d i t o r i s "." and t h e o u t p u t p r e f i x c h a r a c t e r i s When t h e e d i t o r i s f i r s t e n t e r e d , i t r e s p o n d s w i t h t h e name o f t h e f u n c t i o n i t i s e d i t i n g and t h e c u r r e n t e x p r e s s i o n a s p r i n t e d by t h e P command (see P command) wh i c h a t t h e b e g i n n i n g i s t h e e n t i r e l i s t s t r u c t u r e . As t h e e d i t o r d e s c e n d s i n t o t h e s t r u c t u r e , i t must know how t o g e t o u t . I t keeps t h i s " b a c k u p " i n f o r m a t i o n on a l i s t c a l l e d t h e EDITCHAIN. T h u s , c h a n g i n g t h e e d i t o r s a t t e n t i o n amounts t o c h a n g i n g t h e EDITCHAIN. We c a n now l o o k a t commands which d e s c e n d i n t o and a s c e n d from t h e s t r u c t u r e b e i n g e d i t e d . 4 COMMAND: n , „ - n f 0 T y p i n g a p o s i t i v e i n t e g e r t e l l s t h e e d i t o r t o make t h e new c u r r e n t e x p r e s s i o n t h e n t h e l e m e n t o f t h e c u r r e n t e x p r e s s i o n . Example: .? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .3 ? : (COND ((NULL X) NIL) (T (CONS X X ) ) ) .2 1 ? :(NULL X) Note t h e use o f s e v e r a l commands on a l i n e . The e d i t o r e x e c u t e s a l l commands on a l i n e u n l e s s one c a u s e s an e r r o r i n which c a s e t h e r e s t o f t h e l i n e i s i g n o r e d . A P i s p e r f o r m e d a f t e r e v e r y l i n e u n l e s s t h e l a s t command on t h e l i n e was a P, PP, TEST, UNBLOCK, E, HELP, o r ?. A p o s i t i v e i n t e g e r makes t h e c u r r e n t e x p r e s s i o n t h e n t h from t h e l e f t , a n e g a t i v e i n t e g e r makes t h e c u r r e n t e x p r e s s i o n t h e n t h from t h e r i g h t . Example: •? . « :(COND ((NULL X) NIL) (T (CONS X X ) ) ) . - 1 ? : (T (CONS X X) ) .2 - 1 ? :X A z e r o pops t h e EDITCHAIN once a s c e n d i n g one l e v e l . Example: : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X)) ) ) j "> * \ : (X) . 1 ? :x .0 ? : (X) .0 ? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X) ) ) ) .3 2? : ( (NULL X) NIL) .0 ? : (COND ((NULL X) NIL) (T (CONS X X ) ) ) \ 5 COMMAND: UP A t a i l > o f a l i s t i s d e f i n e d a s b e i n g 0 c r more CDB*s down t h e l i s t . Thus i n t h e s t r u c t u r e 1 2 3 U I i FOO: | A | I I b o x e s 1, 2, 3 and U a r e a l l t a i l s o f FOO. PRINT would s a y (B C D ) i s a t a i l o f (A B C D). The UP command i s used t o l o o k a t t a i l s o f l i s t s . A t a i l i s i n d i c a t e d by t h e ... p r i n t e d by t h e e d i t o r . Example: .? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .3 ? : (COND ((NULL X) NIL) (T CONS X X ) ) ) .UP ? :... (COND ((NULL X) NIL) (T (CONS X X ) ) ) ) ' What has happened i s t h a t t h e c u r r e n t e x p r e s s i o n i s a s c e n d e d e x a c t l y one CAR. C o n t i n u i n g w i t h t h e example: . • :... (COND ((NULL X) NIL) (T (CONS X X ) ) ) ) . 1 ? :(COND ((NULL X) NIL) (T (CONS X X ) ) ) .2 UP ? :... ((NULL X) NIL) (T (CONS X X ) ) ) A f t e r an UP, t h e o l d c u r r e n t e x p r e s s i o n i s t h e f i r s t e l e m e n t o f t h e new c u r r e n t e x p r e s s i o n . I f t h e c u r r e n t e x p r e s s i o n happens t o be t h e f i r s t e l e m e n t o f t h e n e x t h i g h e r e x p r e s s i o n , t h e n an UP and 0 do t h e same t h i n g . I I •>l B | I I j I I >! C | I I I L. I 6 COMMAND! 1 T h i s command d i r e c t s t h e e d i t o r t o "go t o t h e t o p " o f t h e s t r u c t u r e . Example: : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) . 3 2 1 ? : (NULL X) • I ? : (LAMBDA (X) (COND ((NULL X) NIL) (T (CONS X X ) ) ) ) 7 COMMANDj._J.O T h i s command ( u s u a l l y p r o n o u n c e d b a n g - z e r o ) i n s u r e s t h a t t h e c u r r e n t e x p r e s s i o n i s n o t a t a i l o f t h e n e x t h i g h e r e x p r e s s i o n . I t a l w a y s g o e s back t o t h e n e x t h i g h e r c u r r e n t e x p r e s s i o n . Example: .? : (A B C D E F G) .3 DP ? :... C D E F G) .3 UP ? :... E F G) .0 ? :... C D E F G) .3 DP ? :... E F G) . !0 ? : (A B C D E F G) 8 COMMANDi-Ox BK T h e s e two commands d i r e c t t h e e d i t o r t o go t o t h e " n e x t " e l e m e n t o r t o go " b a c k " one e l e m e n t . The s i m p l e s t way t o e x p l a i n t h e i r o p e r a t i o n i s by example. Example: . ? : (LAMBDA (X) (COND ( (NOLL X) NIL) (T (CONS X X ) ) ) ) . 1 ? :LAMBDA .NX ? : (X) .NX ? : (COND {(NULL X) NIL) (T (CONS X X ) ) ) .1 ? :COND .NX ? : ( (NULL X) NIL) .NX ? : (T (CONS X X) ) .BK ? : ( (NULL X) NIL) .BK ? :COND NX e f f e c t i v e l y does an UP f o l l o w e d by a 2. I t c a n be u s e f u l when s t e p p i n g t h r o u g h COND, PROG and SELECT c l a u s e s . 9 COMMANDi_J.NX The NX command w i l l f a i l i f t h e c u r r e n t e x p r e s s i o n i s t h e l a s t e l e m e n t o f t h e n e x t h i g h e r e x p r e s s i o n . The !NX command makes t h e c u r r e n t e x p r e s s i o n t h e n e x t e x p r e s s i o n a t a h i g h e r l e v e l . I t w i l l go t h r o u g h any number o f r i g h t p a r e n t h e s e s t o g e t t h e n e x t e x p r e s s i o n . Example: .? : (LAMBDA (X) (COND ( (NOLL X) NIL) (T (CONS X X ) } ) ) . 3 2 1 ? : (NULL X) .NX ? :NIL .NX ? :YOU»BE AT THE END . ! NX ? : (T (CONS X X) ) Here, t h e NX command f a i l e d b e c a u s e NIL i s t h e l a s t e x p r e s s i o n i n ((NULL X) NIL) b u t !NX w i l l s u c c e e d and go t o t h e (T (CONS X X ) ) . To c o n t i n u e w i t h t h e example: .? : ( T (CONS X X)) .0 0 ? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .2 1 ? :X . ! NX : (COND ((NULL X) NIL) (T (CONS X X ) ) ) 1 0 COMMAND! I T h i s command c a u s e s t h e e d i t o r t o s e a r c h t h e c u r r e n t e x p r e s s i o n f o r t h e n e x t " t h i n g " i n t h e command s t r e a m . U s u a l l y t h i s " t h i n g " i s an atom. B e c a u s e t h e r e i s n o t h i n g t h a t c an be done w i t h an atom e x c e p t l o o k a t i t , t h e F command s e a r c h e s f o r a l i s t whose CAR i s t h e " t h i n g " . I f t h e c u r r e n t e x p r e s s i o n i s an atom a f t e r an F command, t h e e d i t o r does an UP. Example: .? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) . F X ? : (X) The e d i t o r i s a s k e d t o f i n d t h e f i r s t o c c u r r e n c e o f t h e atom X ( i n PRINT o r d e r ) . I t f i n d s a l i s t whose CAR i s X and t h a t l i s t becomes t h e c u r r e n t e x p r e s s i o n . C o n t i n u i n g w i t h t h e example: .| F NULL ? :(NULL X) .| F COND ? F X ? : (COND ((NULL X) NIL) (T (CONS X X ) ) ) :... X) .0 ? : (NULL X) .UP UP ? F CONS ? :... ((NULL X) NIL) (T (CONS X X ) ) ) : (CONS X X) . | F (NULL X) ? :(NULL X) W h i l e s e a r c h i n g , t h e F command l o o k s f o r 1. S o m e t h i n g EQUAL t o i t s argument 2. S o m e t h i n g whose CAR i s EQ t o i t s argument. The F command do e s no CONSes u n l e s s i t f i n d s what i t i s l o o k i n g f o r , and t h e n o n l y enough t o b u i l d t h e EDITCHAIN. I f F f a i l s , t h e EDITCHAIN i s n o t c h a n g e d . 1 1 COMMANDS WHICH CHANGE THE EDITED STRUCTURE T h i s s e c t i o n w i l l d i s c u s s t h e commands w h i c h change t h e s t r u c t u r e b e i n g e d i t e d . T h e s e commands use RPLACA's and RPLACD's t o p e r f o r m t h e i r m o d i f i c a t i o n s and a r e t h u s d e s t r u c t i v e . T h i s i s u s e f u l when t h e e d i t o r i s c a l l e d w h i l e i n a BREAK. I f a f u n c t i o n i s cha n g e d , t h e change w i l l a f f e c t e ven p r e v i o u s e n t r i e s on t h e s t a c k . A l l s t r u c t u r a l c h a n g e s a r e u n d o a b l e . S i n c e t h e a c t o f u n d o i n g i s i t s e l f a s t r u c t u r a l c h a n g e , UND0*s a r e u n d o a b l e . T h i s s h o u l d a l l o w t h e u s e r t o e x p e r i m e n t w i t h t h e e d i t o r w i t h some d e g r e e o f s a f e t y . He c a n a l w a y s UNDO h i s m i s t a k e s . A l l s t r u c t u r e c h a n g i n g commands use t h e same r o u t i n e t o f i n d t h e p o s i t i o n t o p e r f o r m t h e m o d i f i c a t i o n ( c a l l e d t h e l o c a t i o n s p e c i f i c a t i o n ) . T h e s e r o u t i n e s o p e r a t e i n t h e f o l l o w i n g manner. 1 . I f i t s argument i s an e d i t o r command, e x e c u t e i t . T h e s e must be commands which t a k e no a r g u m e n t s (NX, but n o t P ) . 2. I f i t s argument i s not an e d i t o r command, p e r f o r m an F ( f i n d ) on i t . S t r u c t u r e m o d i f y i n g commands NEVER change t h e e d i t o r s a t t e n t i o n . I f t h e e n t i r e c u r r e n t e x p r e s s i o n i s d e l e t e d , t h e o p e r a t i o n w i l l n o t a p p e a r by t y p i n g a ?. 12 COMMAND: INSERT. I I i s the a b b r e v i a t e d form of the INSERT command. The gen e r a l form i f the INSERT command i s AFTER INSERT S1 S2 S3 ... SN BEFORE P1 P2 P3 ... PN <:> FOR Because the INSERT command takes an a r b i t r a r y number of arguments, a : or end of l i n e i s used to i n d i c a t e the end of command. The S*s are the " t h i n g s 1 to be i n s e r t e d . The P's are the l o c a t i o n s p e c i f i c a t i o n . Example: • ? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .INSERT (A B C) AFTER X : ? : (LAMBDA (X) (A B C) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) Since the X i s not an e d i t o r command, a F X i s performed which f i n d s the l i s t ( X ) . .? : (LAMBDA (X) (A B C) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) • INSERT B BEFORE X 1 : ? : (LAMBDA (B X) ( A B C ) (COND ((NULL X) NIL) (T (CONS X X ) ) ) ) Here, the X again causes an F X to be performed f i n d i n g the (X), the 1 i s an e d i t o r command which made the c u r r e n t e x p r e s s i o n X and the B was i n s e r t e d before i t . .F NULL ? INSERT B FOR X : ? :(NULL X) :(NULL B) .INSERT ABC D AFTER B : ? : (NULL B ABC D) Th i s time, a B i s searched f o r i n the s u b s t r u c t u r e (NULL B) and i s found, the c u r r e n t e x p r e s s i o n becomes ... B). The INSERT i n s e r t s the ABC D a f t e r the B. Instead of t y p i n g F NULL INSERT B FOR X, we c o u l d have used INSERT B FOR NULL X which would do a F NULL and a F X. 13 COWHAND: DELETE. D The D command i s t h e a b b r e v i a t e d form o f t h e DELETE. The g e n e r a l f o r m i s : DELETE P1 P2 P3 ... PN <:> where t h e P*s a r e t h e l o c a t i o n s p e c i f i c a t i o n o f t h e i t e m t o be d e l e t e d . Example: : (LAMBDA (Q X) (A B C) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .DELETE Q 1 : ? : (LAMBDA (X) (A B C) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) I n t h i s e x a mple, t h e Q f o u n d t h e l i s t (Q X) and t h e 1 made t h e c u r r e n t e x p r e s s i o n Q, w h i c h i s d e l e t e d . .? : (LAMBDA (X) (A B C) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) .DELETE ( A B C ) : ? : (LAMBDA (X) (COND ( (NULL X) NIL) (T (CONS X X ) ) ) ) • We c o u l d have used D A, D (A B C ) , D 2, D 1 NX, o r any way we want t o f i n d t h e (A B C ) . In t h e example, we c a n s p e c i f y t h e e n t i r e s t r u c t u r e i f we want. .? : (LAMBDA (X) (COND ( (NULL X) NIL) (T CONS X X ) ) ) ) .DELETE NIL ? : (LAMBDA (X) (COND ( (NULL X)) (T (CONS X X ) ) ) ) 14 COMMAND: EMBED, EM The EM command i s t h e a b b r e v i a t e d form o f EMEED. The g e n e r a l form i s : EMBED P1 P2 P3 ... PN IN I \ 0 where t h e P's a r e t h e l o c a t i o n s p e c i f i c a t i o n o f t h e i t e m t o be embedded and t h e I i s t h e s t r u c t u r e t o c o n t a i n i t . I n L I S P , b e c a u s e o f i t s n e s t e d f u n c t i o n s t r u c t u r e , s p e c i a l commands ( t h e EMBED and EXTRACT) a r e i n c l u d e d t o i n s e r t f u n c t i o n s i n s i d e o t h e r f u n c t i o n s . I t i s n o t uncommon t o s i m p l y want t o embed a s t r u c t u r e i n a QUOTE o r PRINT. Example: .? : (COND ((NULL X) NIL) (T (CONS X X ) ) ) .EMBED NULL IN (PRINT *) ? : (COND ((PRINT (NULL X)) NIL) (T (CONS X X ) ) ) The EMBED o p e r a t e s by r e p l a c i n g e v e r y o c c u r a n c e o f '»*" i n t h e I by t h e c u r r e n t e x p r e s s i o n and p e r f o r m i n g an INSERT FOR on t h e c u r r e n t e x p r e s s i o n . .EMBED CONS IN (CONS * *) ? : (COND ((PRINT (NULL X)) NIL) (T (CONS (CONS X X) (CONS X X ) ) ) ) Note , t h e r e i s no need f o r t h e : t o t e r m i n a t e t h e command (as i n t h e INSERT and DELETE) b e c a u s e t h e r e c a n be o n l y one i t e m f o l l o w i n g t h e IN. i 15 C O M « & N D l _ E X T R A C T x EX EX i s t h e a b b r e v i a t e d f o r m o f t h e EXTRACT command. The g e n e r a l f o r m i s : EXTRACT P1 P2 P3 ... PH FROM Q1 Q2 Q3 ... ON <:> where t h e P*s a r e t h e l o c a t i o n s p e c i f i c a t i o n o f t h e i t e m t o r e p l a c e t h e i t e m s p e c i f i e d by t h e Q's. Where t h e EMBED command i s us e d t o n e s t one f u n c t i o n w i t h i n a n o t h e r , t h e EXTRACT removes a n e s t i n g . The i t e m s p e c i f i e d by t h e Q's must be w i t h i n t h e i t e m s p e c i f i e d t y t h e P » s . Example. .?? : (COND ( (NULL (CAR X)) NIL) (T (CONS (CAR X) (CADR X ) ) ) ) .EXTRACT CAR FROM NULL : ? : (COND ((CAR X) NIL) (T (CONS (CAR X) (CADR X ) ) ) ) .EXTRACT CONS FROM COND : ? : (CONS (CAR X) (CADR X)) The EXTRACT command r e p l a c e s a s t r u c t u r e L by a s u b s t r u c t u r e o f L. 16 COMMANDS THAT "MOVE PARENTHESES" S i n c e p a r e n t h e s e s a r e s i m p l y n o t a t i o n s t o (READ) and (PRINT), i t i s i m p o s s i b l e t o add o r remove one l e f t o r r i g h t p a r e n t h e s i s . T h e s e commands a r e use d t o change t h e s t r u c t u r e b e i n g e d i t e d s o t h a t when t h e s t r u c t u r e i s p r i n t e d , i t l o o k s a s t h o u g h a p a r e n t h e s i s was moved, o r a p a i r o f p a r e n t h e s e s was added o r removed. 17 COMMAWD:_MLx_MR T h e s e commands move a l e f t p a r e n t h e s i s o r move a r i g h t p a r e n t h e s i s . T h e i r g e n e r a l form i s : ML • i n t e g e r P1 P2 P3 ... Pn <:> HR P o r b o t h commands, a p o s i t i v e i n t e g e r i n d i c a t e s t h e p a r e n t h e s i s i s t o be moved t o t h e r i g h t , a n e g a t i v e i n t e g e r i n d i c a t e s t h e p a r e n t h e s i s i s t o be moved t o t h e l e f t . The P's a r e t h e l o c a t i o n s p e c i f i c a t i o n f o r t h e l i s t whose p a r e n t h e s i s i s t o be "moved". v Example: . • : (A B C {D E F) G H I) .ML -1 4 : ? : (A B (C D E F) G H I) I t a p p e a r s a s i f t h e l e f t p a r e n t h e s i s o f t h e 4 t h e l e m e n t has been moved 1 p l a c e t o t h e l e f t (-1 p l a c e s t o t h e r i g h t ) . : (A B (C D E F) G H I) .ML 3 C : ? : (A B C D E (F) G H I) The l e f t p a r e n t h e s i s o f t h e l i s t whose CAR i s C i s moved 3 p l a c e s t o t h e r i g h t . . • : (A B C D E (F) G H I) .MR 2 F : ? : (A B C D E (F G H) I) The move r i g h t command i s use d t o move t h e r i g h t p a r e n t h e s i s o f t h e l i s t whose CAR i s F 2 p l a c e s t o t h e r i g h t . 7 : (A B C D E (F G H) I) • MR -1 F : ? : (A B C D E (F G) H I ) 18 C O M M A N £ i_ S I G e n e r a l f o r m : B l P1 P2 P3 ... Pm THRU Q1 Q2 Q3 ... Qn <:> where t h e P's and Q*s a r e l o c a t i o n s p e c i f i c a t i o n s . T h i s command i s u s e d t o i n s e r t a p a i r o f l e f t a nd r i g h t p a r e n t h e s e s b e f o r e t h e e l e m e n t s p e c i f i e d by t h e P's and a f t e r t h e e l e m e n t s p e c i f i e d by t h e Q's. Example: •> m • : (a B C D E F) . B l B THRU E : ? : (A (B C D E) F) . B l C THRU D : ? : (A (B (C D) E) F) . B l 1 NX THRU -1 BK : ? : (A (( B (C D) E) ) F) 19 COMMAND: BO T h i s command i s u s e d t o remove a p a i r o f p a r e n t h e s e s (or t a k e " b o t h out")» The g e n e r a l form i s : BO P1 P2 P3 ... Pn <:> ' where t h e P»s a r e t h e l o c a t i o n s p e c i f i c a t i o n o f t h e l i s t whose p a r e n t h e s e s a r e t o be removed. Example: . ? : (A ((B (C D) E)) F) .BO C : ? : (A ( (B C D E) ) F) .BO 2 : ? : (A (B C D E) F) .BO 1 NX : ? : (A B C D E F) 20 COMMANDS THAT UNDO F o r e a c h s t r u c t u r a l change made, an e n t r y i s a l s o made on a l i s t c a l l e d t h e u n d o l i s t . T h e r e a r e 4 commands which a f f e c t u n d o i n g . UNDO and !UND0 a c t u a l l y undo t h e c h a n g e s . TEST and UNBLOCK h e l p t o d e t e r m i n e what i s t o be undone. The undo f a c i l i t i e s o f t h e e d i t o r p e r m i t t h e e d i t e d s t r u c t u r e t o be r e s t o r e d t o i t s s t a t e a t any p r i o r p o i n t i n t h e e d i t i n g s e s s i o n . T h e s e f e a t u r e s s h o u l d e n c o u r a g e t h e u s e r t o e x p e r i m e n t w i t h t h e e d i t o r ; he can a l w a y s p a i n l e s s l y r e c o v e r f r o m h i s m i s t a k e s . 21 C0MM6NDl_?? T h i s command c a u s e s t h e e n t r i e s on t h e u n d o l i s t t o be l i s t e d . Example: .? : (A B C D E F) .INSERT (W X Y) AFTER C : ? : (A B C (W X Y) D E F) .DELETE D : ? : (A B C (W X Y) E F) .MR 1 w : ? : (A B C (W X Y E) F) • • • :MR DELETE INSERT T h e r e a r e t h r e e " t h i n g s " on t h e u n d o l i s t and t h e y a r e l i s t e d (and undone) i n t h e i n v e r s e o r d e r o f t h e i r e n t r y . 22 COMMAND:UNDO T h i s command c a u s e s t h e l a s t s t r u c t u r a l c h ange t o be undone. Example: .? : (ft B C D E F) .DELETE C : DELETE D : ? : (A B E F) L .UNDO 0 :DELETE UNDONE L .? ? :(A B D E F) .DNDO NDO :DELETE UNDONE L .? ? :(A B C D E F) .UNDO NDO :NOTHING SAVED .?? ?? :UNDO UNDO Note UNDO's and !UNDO»s a r e s k i p p e d by t h e UNDO command u n l e s s t h e y a r e s p e c i f i c a l l y r e q u e s t e d . .UNDO UNDO :UNDO UNDONE .? : (A B D E F) 23 COMMAND: 1JJNDO i The !UNDO command undoes a l l c h a n g e s back t o t h e b e g i n n i n g o r t o t h e f i r s t UNDO b l o c k (see TEST and UNBLOCK). Example: .? : (A B C (D E F) G H I) .INSERT (W X Y) Z AFTER B : ? : (A B (W X Y) Z C ( D E F ) G H I) .DELETE D : ? : (A B (W X Y) Z C G H I) .MR 5 W : ? : (A B ( W X Y Z C G H I ) ) .!UNDO NDO :MR UNDONE :DELETE UNDONE :INSERT UNDONE : (A B C (D E F) G H I) L . ? ? ? :!UNDO .UNDO ! UNDO UNDO :!UNDO UNDONE : ( A B ( W X Y Z C G H I ) ) L .?? ? :UNDO 24 COMMAND:,TEST, UNBLOCK A b l o c k may be p l a c e d on t h e u n d o l i s t i n two ways. I f t h e TEST command i s e n t e r e d , t h e n a b l o c k i s p l a c e d on t h e f r o n t o f t h e u n d o l i s t . A l s o , a f t e r e ach e d i t i n g s e s s i o n , a l l UNDO i n f o r m a t i o n i s s a v e d on t h e atom o f t h e f u n c t i o n name w i t h a b l o c k on t h e f r o n t s o t h a t e d i t i n g s e s s i o n s a r e d i v i d e d . The command UNBLOCK removes t h e f i r s t undo b l o c k on t h e u n d o l i s t . Example: • • : (A B C ( D E E ) G H I) .DELETE D : DELETE C : INSERT (WW WW) AFTER H : MR 1 W : ? ?? : (A B G H (W W W W I) ) :MR INSERT DELETE DELETE .TEST ?? T ?? :BLOCK MR INSERT DELETE DELETE L .? ? : (A B G H (W W W W I ) ) • DELETE W : DELETE B : ? ?? : (A G H) :DELETE DELETE BLOCK MR INSERT DELETE DELETE . !UNDO •DELETE UNDONE :DELETE UNDONE . ? ?? : ( A B G H ( W W W W I ) ) ;!UNBO BLOCK MR INSERT DELETE DELETE The !UNDO was s t o p p e d by t h e b l o c k on t h e u n d o l i s t . The TEST command i s u s e f u l f o r making t e n t a t i v e c h a n g e s which a r e e a s i l y removed by a !UNDO. We c a n remove t h e undo b l o c k by t y p i n g : .UNBLOCK ?? :!UNDO MR INSERT DELETE DELETE .JUNDO : !UNDO UNDONE : MR UNDONE :INSERT UNDONE :DELETE UNDONE :DELETE UNDONE .? ?? : (A B C (D E F) G H I) .!UNDO 25 COWHANDS THAT PBINT COMMANDj._P x_? x_PP P i s t h e s t a n d a r d p r i n t command o f t h e e d i t o r . I t p r i n t s t h e c u r r e n t e x p r e s s i o n up t o d e p t h 2. I f f o l l o w e d by an i n t e g e r n, i t p r i n t s up t o d e p t h n. Example: • • : (LAMBDA (X) (COND ( (NOLL X) NIL) (T (CONS X X ) ) ) ) .P : (LAMBDA (X) (COND & 5) ) .P 3 : (LAMBDA (X) (COND (8 NIL) (T S) ) ) U s u a l l y t h e e n t i r e c u r r e n t e x p r e s s i o n i s t o o b i g and o n l y P i s u s e d . The command ? Has been used f o r examples h e r e so t h a t t h e e n t i r e c u r r e n t e x p r e s s i o n c o u l d be s e e n . The ? Command i s t h e same as P 1000. The PP command p r e t t y p r i n t s t h e c u r r e n t e x p r e s s i o n . Example: . PP : (LAMBDA (X) : (COND ( (NULL X) NIL) : (T (CONS X X)) ) ) 26 COMMAND:-«P S t r i c t l y s p e a k i n g , t h i s i s n o t a p r i n t command but an a t t e n t i o n c h a n g i n g command. I t r e s t o r e s t h e EDITCHAIN t o where i t was a s o f two p r i n t s ago. I t i s u s e f u l f o r s w i t c h i n g back and f o r t h between EDITCHAINS. Example: .P : (LAMBDA (X) (COND & S) ) . F NULL P --P : (NULL X) : (LAMBDA (X) (COND 6 6)) In t h i s example, t h e F NULL f o u n d t h e f i r s t c l a u s e o f t h e COND. The -»P s e n d s us back t o t h e (LAMBDA (X) (COND 6 6 ) ) . A n o t h e r -»P would make t h e c u r r e n t e x p r e s s i o n (NULL X) a g a i n . 27 MISCELLANEOUS COMMANDS COMMAND: S T h i s command s a v e s t h e c u r r e n t e x p r e s s i o n on t h e p r o p e r t y l i s t o f t h e n e x t " t h i n g " i n t h e i n p u t s t r e a m . T h i s v a l u e c a n l a t e r be used by an INSERT command by u s i n g a ## b e f o r e t h e " t h i n g " i n t h e l i s t o f i t e m s t o be i n s e r t e d . The s a v e d c u r r e n t e x p r e s s i o n c a n a l s o be f o u n d by E V A L i n g (GET "THING" **EDITFLAG*). Example: .? : (LAMBDA (X) (COND ( (NULL X) NIL) .F NULL P S QREG | ? : (NULL X) : (LAMBDA (X) (COND ( (NULL X) NIL) .INSERT ## QREG FOR CONS : ? : (LAMBDA (X) (COND ( (NULL X) NIL) I n t h e example, (NULL X) was s a v e d on t h e atom QREG ( a c t u a l l y , i n o r d e r t o p r o t e c t a g a i n s t c i r c u l a r l i s t s , a co p y i s made). The INSERT command i n s t r u c t s t h e e d i t o r t o g e t t h a t v a l u e (by p r e c e d i n g QREG by t h e atom ## and i n s e r t i t f o r t h e CONS. I f , a t t h e t o p l e v e l o f L I S P we EVALEd (GET fQREG » * E D I T F L A G * ) , (NULL X) would be r e t u r n e d . COMMAND:.! T h i s command EVALs t h e n e x t " t h i n g " i n t h e i n p u t s t r e a m . I t i s n o t " e r r o r s e t " p r o t e c t e d , t h a t i s , i t w i l l p o s s i b l y d e s t r o y s a v e d i n f o r m a t i o n (EDITCHAIN, u n d o l i s t , e t c . ) i f a bad form i s EVALed. I f t h e s t a c k ' i n f o r m a t i o n i s r e t a i n e d ( t h r o u g h t h e e r r o r p a c k a g e , f o r e x a m p l e ) , t h e n t h e e d i t o r may be r e e n t e r e d a t EDITONE o r EDITNEXT by EV A L i n g (UNEVAL "EDITONE NIL) o r (UNEVAL * EDITNEXT N I L ) . COMMAND: OK T h i s command e x i t s t h e e d i t o r s a v i n g t h e u n d o l i s t cn t h e p r o p e r t y l i s t o f t h e f u n c t i o n name i f t h e s t r u c t u r e b e i n g e d i t e d was a f u n c t i o n . COMMAND:HELP T h i s command c a u s e s a b r i e f d e s c r i p t i o n o f t h e e d i t o r commands t o be l i s t e d on t h e u s e r ' s t e r m i n a l . (T (CONS X X ) ) ) ) (T (CONS X X ) ) ) ) (T (NULL X ) ) ) ) 28 DEFAULTS The commands INSERT, MR, ML, BO, B l , EXTRACT may have t h e i r l a s t argument l e f t o u t . I f t h e command was an INSERT, t h e n FOR i s assumed and t h e S*s w i l l be i n s e r t e d FOR t h e c u r r e n t e x p r e s s i o n . F o r t h e o t h e r s , t h e c u r r e n t e x p r e s s i o n i s assumed. 29 A SAMPLE EDITING RON A sample e d i t i n g r u n i s p r e s e n t e d h e r e t o show t h e use o f s e v e r a l commands. The f u n c t i o n s which w i l l be e d i t e d a r e s u p p o s e d t o p r i n t t h e names o f a l l atoms which d o n ' t have a s y s t e m f u n c t i o n on t h e i r p r o p e r t y l i s t s . I t i s assumed t h a t t h e e d i t o r i s i n memory. *<DEFUN SYSFIND (X) (MAPC 'SYSPRONT ( (CBLIST> > SYSFIND *<DEFUN SYSPRINT (X) (CONS ( (GETL X • (SOBR NSOBR) NIL) (T (PRINT ¥> > SYSPRINT * (EDITF SYSFIND SYSPRINT) :EDITING SYSFIND :(LAMBDA (X) (MAPC & S)) .PP :(LAMBDA (X) : (MAPC (QUOTE SYSPRONT) ( ( O B L I S T ) ) ) ) .OK :EDITING SYSPRINT :(LAMBDA (X) (CONS S)) .PP : (LAMBDA (X) : (CONS : ((GETL X (QUOTE (SUBR NSUBR) ) NIL) : (T (PRINT Y) ) ) ) ) .OK > NIL We p r e t t y p r i n t t h e f u n c t i o n s t o s e e how t h e y l o o k , t h e n t r y them. We c o u l d u s e t h e E command t o t r y t h e f u n c t i o n s , but t h a t would r e q u i r e some knowledge o f t h e b r e a k package which we do n o t assume h e r e . *(SYSFIND) + + TOO MANY ARGUMENTS + SYSFIND ?NIL » (EDITF SYSFIND) :EDITING SYSFIND : (LAMBDA (X) (MAPC 6 S) ) .INSERT NIL FOR X : (LAMBDA NIL (MAPC & 5) ) * OK > NIL The (X) was wrong h e r e , we remove i t and t r y a g a i n . * (SYSFIND) + + ***17 UNDEFINED FUNCTION + 110 ?NIL * ( E D I T F SYSFIND) 30 :EDITING SYSFIND : (LAMBDA NIL (MAPC S S)) .PP : (LAMBDA NIL : (MAPC (QUOTE SYSPRONT) ( ( O B L I S T ) ) ) ) .BO OBLIST : PP 3 (LAMBDA NIL : (MAPC (QUOTE SYSPRONT) (OBLIST))) .OK > NIL The 110 j u s t happened t o be t h e f i r s t atom on t h e c b l i s t and was EVALed b e c a u s e o f t h e e x t r a s e t o f p a r e n t h e s e s . We remove them and t r y a g a i n . * (SYSFIND) + + ***17 UNDEFINED FUNCTION * SYSPRONT ?NIL * (EDITF SYSFIND) :EDITING SYSFIND : (LAMBDA NIL (MAPC & S)) .INSERT SYSPRINT FOR SYSPRONT : ? : (LAMBDA NIL (MAPC (QUOTE SYSPRINT) ( O B L I S T ) ) ) .OK > NIL SYSPRINT was t y p e d i n c o r r e c t l y so we change i t w i t h an i n s e r t command. N o t e , t h e r e i s no need t o s e a r c h f o r t h e SYSPRONT, t h e i n s e r t w i l l do t h a t f o r u s . • (SYSFIND) + + ***17 UNDEFINED FUNCTION + NIL ?NIL * (EDITF SYSPRINT) :EDITING SYSPRINT : (LAMBDA (X) (CONS S) ) .PP : (LAMBDA (X) : (CONS : ((GETL X (QUOTE (SUBR NSUBR)) NIL) : (T (PRINT ¥))))) .INSERT COND FOR CONS : PP : (LAMBDA (X) : COND) . UNDO :INSERT UNDONE .PP : (LAMBDA (X) : (CONS : {(GETL X (QUOTE (SUBR NSUBR)) NIL) : (T (PRINT ¥))))) .INSERT COND FOR CONS 1 : PP 31 : (LAMBDA (X) : (COND : ((GETL X (QUOTE (SUBR NSUBR) ) NIL) : (T (PRINT Y) ) ) ) ) • OK > NIL I n t h e above t r y , we d i s c o v e r t h a t t h e r e i s an e r r o r i n SYSFIND s o we p r e t t y p r i n t i t and s e e t h a t we t y p e d CONS f o r COND. We use t h e i n s e r t command t o c h a n g e i t b u t f o r g e t t h a t i t w i l l f i n d t h e l i s t (CONS S 8) i n s t e a d o f t h e atom CONS. The i n s e r t d o e s n ' t do what we want t o do. We undo t h e i n s e r t arid t r y a g a i n , t h i s t i m e s u c c e e d i n g . We t r y a g a i n . • (SYSFIND) 1 + • ***17 UNDEFINED FUNCTION + T ?NIL * (EDITF SYSPRINT) :EDITING SYSPRINT : (LAMBDA (X) (COND S) ) .PP : (LAMBDA (X) : (COND : ((GETL X (QUOTE (SUBR NSUBR)) NIL) : * (T (PRINT Y) )) ) ) .3 : (COND (S 5) ) .MR -1 2 : (COND (S) (T 6) ) .PP : (COND ((GETL X (QUOTE (SUBR NSUBR)) NIL)) : (T (PRINT Y) ) ) .MR -1 GETL : PP : (COND ((GETL X (QUOTE (SUBR NSUBR))) NIL) : (T (PRINT Y)) ) .P : (COND (S NIL) (T 6) ) .OK > NIL In t h e above t e s t , we d i s c o v e r t h a t p a r e n t h e s e s e r r o r s were made when t h e f u n c t i o n s were t y p e d i n . We use b o t h t h e PP and P commands t o show t h e n e s t i n g s . * (SYSFIND) + • ***16 UNDEFINED ATOM • Y ?NIL * (EDITF SYSFIND) :EDITING SYSFIND : (LAMBDA NIL (MAPC S 6)) .INSERT X FOR Y : PP :Y NOT FOUND i .OK 32 > NIL * (EDITF SYSPRINT) :EDITING SYSPRINT : (LAMBDA (X) (COND 5 6) ) .INSERT X FOR Y : PP : (LAMBDA (X) : (COND ((GETL X (QUOTE (SUBR NSUBR))) NIL) : (T (PRINT X) ) ) ) .OK > NIL Above, we t r y t o change t h e atom Y t o t h e atom X but we c a l l t h e e d i t o r on t h e wrong f u n c t i o n . He e x i t and t y p e t h e r i g h t f u n c t i o n name i n . He change t h e Y t o X, p r e t t y p r i n t i t t o s e e t h a t a l l i s ok, and t r y a g a i n • (SYSFIND) >-<* >110 >68 >26 + ***16 UNDEFINED ATOM + X ?NIL * (EDITF SYSPRINT) :EDITING SYSPRINT ,: (LAMBDA (X) (COND S S)) .PP : (LAMBDA (X) : (COND ( (GETL X (QUOTE (SUBR NSUBR))) NIL) : (T (PRINT X ) ) ) ) .INSERT ( (EQ (CAR »X) «*UNDEF*) NIL) AFTER COND 1 : PP : (LAMBDA (X) : (COND : ( (EQ (CAR (QUOTE X)) (QUOTE *UNDEF*)) : NIL) : {(GETL X (QUOTE (SUBR NSUBR))) NIL) : (T (PRINT X) ) )) .OK > NIL The above c a s e i s more s u b t l e . Hhen we do a GET! on t h e atom •UNDEF*, we c r e a t e an e r r o r c o n d i t i o n . We c a n n o t EVAL t h e atom •UNDEF*. To s o l v e t h i s p r o b l e m , we f i r s t c h e c k t h e v a l u e (CAR) o f X t o s e e i f i t i s t h e u n d e f i n e d atom *DNDEF*, and i f s o , we s t o p t h e r e . * (SYSFIND) >-4 >110 >68 >26 33 >DISPLAY * ( E D I T F SYSPRINT) :EDITING SYSPRINT :(LAMBDA (X) (COND 6 G)) .INSERT FSUBR AFTER NSUBR : OK > NIL We s e e from t h e o u t p u t , t h a t some f u n c t i o n s a r e s n e a k i n g t h r o u g h b e c a u s e we f o r g o t t o c h e c k f o r FSUBRs. We change SYSPRINT (we a r e b r a v e and d o n ' t p r i n t t h e change) and our f u n c t i o n w i l l work. I n t h e f o l l o w i n g example, we e d i t a PLANNER theorem w i t h E D I T E . PLANNER t h e o r e m s a r e s t o r e d on p r o p e r t y l i s t s u n d e r t h e i n d i c a t o r THEOREM. *<DEFPROP F THEOREM (THCONSE (IN HOUSE $?X) (THGCAL $?X> > F * (EDITE (GET F 'THEOREM)) : (THCONSE (IN HOUSE -$?X) (THGOAL $?X) ) .EMBED THGOAL 2 IN (RABBIT *) PP : (THCONSE (IN HOUSE $?X) : (THGOAL (RABBIT $ ? X ) ) ) .OK > NIL I n t h e above example, we c a l l t h e e d i t o r on a s t r u c t u r e which i s a PLANNER t h e o r e m , we make a change and e x i t . EDITOR FUNCTIONS The f o l l o w i n g a r e t h e t o p l e v e l f u n c t i o n s o f t h e e d i t o r . EDITF T h i s i s an FEXPR. I t l o o k s f o r t h e p r o p e r t y EXPR MACRO, o r BUG on t h e p r o p e r t y l i s t o f i t s a t o m i c a r g u m e n t s . EDITE T h i s i s an EXPR. I t p a s s e s i t s EVALed argument t o t h e e d i t o r . EDITEXCISE T h i s i s a f u n c t i o n o f no ar g u m e n t s . I V A l i n g i t removes t h e e d i t o r f u n c t i o n d e f i n i t i o n s f r e e i n g s t o r a g e o f t h e e d i t o r . The r e s u l t i n g f r e e c o r e i s t h e n a v a i l a b l e a s work s p a c e . A l l t h e s e f u n c t i o n s a r e f o u n d i n t h e f i l e CS:MINIED. 35 EDITOR INTERNAL FUNCTIONS The f o l l o w i n g i s a l i s t o f t h e major e d i t o r f u n c t i c n s and o p e r a t i o n . t h e i r EDITF EDITNEXT EDITSMASH EDITSTART EDITONE EDITFIND th e t o p l e v e l f u n c t i o n f o r e d i t i n g f u n c t i o n d e f i n i t i o n s . EDITF opens t h e n e c e s s a r y b u f f e r s and p e r f o r m s t h e s t a t u s c a l l s . I t t h e n u s e s GETL t o f i n d t h e f u n c t i o n d e f i n i t i o n p a s s i n g i t t o EDITSTART. i s t h e e d i t o r i n p u t f u n c t i o n . T o g e t h e r w i t h EDITINTERCEPT, i t r e t u r n s t h e n e x t i t e m i n t h e i n p u t s t r e a m . I t t a k e s a s argument a code w h i c h d i r e c t s t h e i n t e r c e p t f u n c t i o n t o e i t h e r s i g n a l an e r r o r c o n d i t i o n i f t h e r e i s no more d a t a (code T ) , r e t u r n *EDITFLAG* on end o f l i n e (code o f A) o r r e a d a new l i n e (code o f N I L ) . p e r f o r m s t h e s t r u c t u r e c h a n g e s f o r t h e INSERT, DELETE, EBBED, and EXTRACT commands as w e l l as t h e p a r e n t h e s i s moving commands. I t t a k e s a s a r g u m e n t s any number o f t r i p l e t s . E ach t r i p l e t d e s c r i b e s how a p a r t i c u l a r CONS c e l l i s t o be c h a n g e d ( t h e c e l l , i t s new CAR, and i t s new CDR). An e n t r y i s made on t h e u n d o l i s t f o r e a c h c a l l t o EDITSMASH. i s t h e READ EVAL l o o p f u n c t i o n o f t h e e d i t o r . c o n t a i n s t h e code f o r most o f t h e e d i t o r commands. I t i s r e a l l y one b i g SELECTQ. i s t h e r e c u r s i v e s e a r c h i n g f u n c t i o n used by t h e F command a s w e l l a s t h e l o c a t i o n s p e c i f i c a t i o n o p e r a t i o n s . I t b u i l d s t h e EDITCHAIN t o t h e i t e m i t f o u n d . EDITCOLLECT i s u sed when i n p u t i t e m s a r e t o be s c a n n e d up t o a d e l i m i t e r (THRU, AFTER, IN, e t c ) . I t r e t u r n s a l i s t o f t h e i t e m s i t c o l l e c t e d . PRINLEV EDITEVAL i s t h e f u n c t i o n u s e d by t h e P and ? commands. I t t a k e s as a r guments t h e e x p r e s s i o n t o be p r i n t e d and t h e l e v e l t o s t o p a t . p e r f o r m s t h e l o c a t i o n s p e c i f i c a t i o n o p e r a t i o n s . I t c h e c k s t o s e e i f an i t e m g a t h e r e d by EDITCOLLECT i s a command and i f s o , c a l l s EDITONE on i t , e l s e i t c a l l s EDITFINDIT (the t o p l e v e l f i n d f u n c t i o n ) on t h e i t e m . EDITUNDO i s t h e u n d o i n g f u n c t i o n . I t t a k e s as argument t h e i t e m on t h e u n d o l i s t t o be undone and t h e t y p e o f unao (UNDO o r !UNEO). 37 DEBUGGING F A C I L I T I E S I n t r o d u c t i o n D e b u g g i n g a c o l l e c t i o n o f L I S P f u n c t i o n s i n v o l v e s i s o l a t i n g p r o b l e m s w i t h i n p a r t i c u l a r f u n c t i o n s a n d / o r d e t e r m i n i n g when and where i n c o r r e c t d a t a a r e b e i n g g e n e r a t e d and t r a n s m i t t e d . , T h e r e a r e t h r e e f a c i l i t i e s w h i c h a i d t h e u s e r i n m o n i t o r i n g h i s program. One o f t h e s e i s t h e E r r o r P a c k a g e which t a k e s c o n t r o l whenever an e r r o r o c c u r s i n a program and w h i c h a l l o w s t h e u s e r t o examine t h e s t a t e o f t h e w o r l d . The o t h e r two f a c i l i t i e s (BREAKF and TRACE) a l l o w t h e u s e r t o ( t e m p o r a r i l y ) m o d i f y s e l e c t e d f u n c t i o n d e f i n i t i o n s so t h a t he c a n f o l l o w t h e f l o w o f c o n t r o l i n h i s p r o g r a m s . A l l o f t h e s e f a c i l i t i e s use t h e same s y s t e m f u n c t i o n , BREAKFUNCTION, a s t h e u s e r i n t e r f a c e . BREAKF and TRACE t o g e t h e r a r e c a l l e d t h e E r e a k Package. BREAKF m o d i f i e s t h e d e f i n i t i o n o f a f u n c t i o n FN, so t h a t i f a b r e a k c o n d i t i o n ( d e f i n e d by t h e u s e r ) i s s a t i s f i e d , t h e e v a l u a t i o n i s h a l t e d t e m p o r a r i l y on a c a l l t o FN. The u s e r c a n t h e n i n t e r r o g a t e t h e s t a t e o f t h e w o r l d , p e r f o r m any c o m p u t a t i o n s , and c o n t i n u e o r r e t u r n from t h e c a l l . TRACE m o d i f i e s a d e f i n i t i o n o f a f u n c t i o n FN so t h a t whenever FN i s c a l l e d , i t s a r g u m e n t s (or some o t h e r v a l u e s s p e c i f i e d by t h e u s e r ) a r e p r i n t e d . When t h e v a l u e o f FN i s computed i t i s p r i n t e d a l s o . The h e a r t o f t h e d e b u g g i n g package i s a f u n c t i o n c a l l e d BREAKFUNCTION. BREAKF and TRACE r e d e f i n e f u n c t i o n s i n t e r m s o f BREAKFUNCTION. When an e r r o r o c c u r s c o n t r o l i s p a s s e d t o BREAKFUNCTION. Whenever L I S P t y p e s a message o f t h e form — BROKEN f o l l o w e d by *n :• t h e u s e r i s t h e n ' t a l k i n g to» BREAKFUNCTION, and he i s ' i n a b r e a k ' . BREAKFUNCTION a l l o w s t h e u s e r t o i n t e r r o g a t e t h e s t a t e o f t h e w o r l d and a f f e c t t h e c o u r s e o f t h e c o m p u t a t i o n . I t u s e s t h e prompt c h a r a c t e r •=' t o i n d i c a t e i t i s r e a d y t o a c c e p t i n p u t (s) f o r e v a l u a t i o n , i n t h e same way a s t h e t o p l e v e l o f LISP u s e s •**. The n b e f o r e t h e •:' i s t h e l e v e l number which i n d i c a t e s how many l e v e l s o f BREAKFUNCTION a r e c u r r e n t l y open. The u s e r may t y p e i n an e x p r e s s i o n f o r e v a l u a t i o n and t h e v a l u e w i l l be p r i n t e d o u t , f o l l o w e d by a n o t h e r '=*. Or t h e u s e r c a n t y p e i n one o f t h e commands d e s c r i b e d below which a r e s p e c i f i c a l l y r e c o g n i z e d by BREAKFUNCTION ( f o r summary o f commands s e e T a b l e I ) . S i n c e BREAKFUNCTION p u t s a l l o f t h e power o f L I S P a t t h e u s e r ' s command, he c a n do a n y t h i n g he c o u l d do a t t h e t o p l e v e l o f L I S P . F o r example, he c a n d e f i n e new f u n c t i o n s o r e d i t e x i s t i n g o n e s , s e t b r e a k s , o r t r a c e f u n c t i o n s . The u s e r may e v a l u a t e an e x p r e s s i o n , s e e t h a t t h e v a l u e was i n c o r r e c t , c a l l t h e e d i t o r , change a f u n c t i o n , and e v a l u a t e t h e e x p r e s s i o n a g a i n , a l l w i t h o u t l e a v i n g t h e b r e a k . I t i s i m p o r t a n t t o e m p h a s i z e t h a t o n c e a b r e a k o c c u r s , t h e u s e r i s i n c o m p l e t e c o n t r o l o f t h e f l o w o f t h e c o m p u t a t i o n , and t h e c o m p u t a t i o n w i l l n o t p r o c e e d w i t h o u t s p e c i f i c i n s t r u c t i o n from him. O n l y i f t h e u s e r g i v e s one o f t h e commands t h a t e x i t s f r o m t h e b r e a k (GO, OK, RETURN, FROM) w i l l t h e c o m p u t a t i o n c o n t i n u e . The c o m p u t a t i o n 38 c a n a l s o be a b o r t e d ( u s i n g J o r | | ) . Note t h a t BREAKFUNCTION i s j u s t a n o t h e r LISP f u n c t i o n , n o t a s p e c i a l s y s t e m f e a t u r e l i k e t h e i n t e r p r e t e r o r t h e g a r b a g e c o l l e c t o r . I t has arguments and r e t u r n s a v a l u e , t h e same as any o t h e r f u n c t i o n . A c a l l t o BREAKFUNCTION has t h e f o r m (BREAKFUNCTION BREAKEXPR BREAKWHEN BREAKFN BREAKCMDS BREAKTYPE) The a r g u m e n t s t o BREAKFUNCTION f o l l o w : BREAKWHEN i s a LISP f u n c t i o n which i s e v a l u a t e d t o d e t e r m i n e i f a b r e a k w i l l o c c u r . I f BREAKWHEN r e t u r n s NIL, BREAKEXPR i s e v a l u a t e d and r e t u r n e d as t h e v a l u e o f t h e b r e a k . O t h e r w i s e a b r e a k o c c u r s . BREAKFN i s t h e name o f t h e f u n c t i o n b e i n g b r o k e n and i s used t o p r i n t an i d e n t i f y i n g message. BREAKCMDS i s a l i s t o f command l i n e s w hich a r e e x e c u t e d as i f t h e y had been t y p e d i n . The command l i n e s on BREAKCMDS a r e e x e c u t e d b e f o r e commands a r e a c c e p t e d from t h e t e r m i n a l , so t h a t i f one o f t h e commands on BREAKCMDS c a u s e s a r e t u r n , a b r e a k o c c u r s w i t h o u t t h e need f o r u s e r i n t e r a c t i o n . BREAKTYPE i d e n t i f i e s t h e t y p e o f t h e b r e a k . I t i s used p r i m a r i l y by t h e e r r o r p a c k a g e and i n a l l c a s e s t h e u s e r c a n use BREAK f o r t h i s a rgument. The v a l u e r e t u r n e d by BREAKFUNCTION i s c a l l e d ' t h e v a l u e o f t h e b r e a k ' . The u s e r c an s p e c i f y t h i s v a l u e e x p l i c i t l y by u s i n g t h e RETURN command d e s c r i b e d below. I n most c a s e s , however, t h e v a l u e o f t h e b r e a k i s g i v e n i m p l i c i t l y , v i a a GO o r OK command, and i s t h e r e s u l t o f e v a l u a t i n g ' t h e b r e a k e x p r e s s i o n ' , BREAKEXPR. BREAKEXPR i s , i n g e n e r a l , an e x p r e s s i o n e q u i v a l e n t t o t h e c o m p u t a t i o n t h a t would have t a k e n p l a c e had no b r e a k o c c u r r e d . I n o t h e r words, one c a n t h i n k o f BREAKFUNCTION a s a f a n c y EVAL, which p e r m i t s i n t e r a c t i o n b e f o r e and a f t e r e v a l u a t i o n . The b r e a k e x p r e s s i o n t h e n c o r r e s p o n d s t o t h e argument t o EVAL. F o r BREAKF and TRACE, BREAKEXPR i s a f o r m e q u i v a l e n t t o t h a t o f t h e f u n c t i o n b e i n g t r a c e d o r b r o k e n . F o r e r r o r s , BREAKEXPR i s t h e form which c a u s e d t h e e r r o r . 39 WHAT YOU CAN DO IN A BREAK 5£g3Js.^ cgjBi.§g 3s. Once i n a b r e a k , i n a d d i t i o n t o e v a l u a t i n g e x p r e s s i o n s , t h e u s e r c a n a s k BREAKFUNCTION t o p e r f o r m c e r t a i n u s e f u l a c t i o n s by g i v i n g i t a t o m i c i t e m s a s " b r e a k commands". The f o l l o w i n g commands c a n be t y p e d i n by t h e u s e r o r may be put on t h e l i s t BREAKCMDS. TABLE I i s a summary o f t h e s e commands. GO R e l e a s e s t h e b r e a k and a l l o w s t h e c o m p u t a t i o n t o p r o c e e d . BREAKFUNCTION e v a l u a t e s BREAKEXPR, i t s f i r s t argument, p r i n t s t h e v a l u e , and r e t u r n s i t as t h e v a l u e o f t h e b r e a k . BREAKEXPR i s t h e e x p r e s s i o n s e t up by t h e f u n c t i o n t h a t c a l l e d BREAKFUNCTION. F o r BREAKF o r TRACE, BREAKEXPR i s e q u i v a l e n t t o t h e body o f t h e d e f i n i t i o n o f t h e b r o k e n f u n c t i o n . F o r t h e e r r o r p a c k a g e , BREAKEXPR i s t h e e x p r e s s i o n i n which t h e e r r o r o c c u r r e d . OK Same a s GO e x c e p t t h a t t h e v a l u e o f BREAKEXPR i s n o t p r i n t e d . EVAL C a u s e s BREAKEXPR t o be e v a l u a t e d . The b r e a k i s m a i n t a i n e d and t h e v a l u e o f t h e e v a l u a t i o n i s p r i n t e d and bound on t h e v a r i a b l e BREAKVALUE. T y p i n g GO o r OK w i l l n o t c a u s e r e e v a l u a t i o n o f BREAKEXPR f o l l o w i n g EVAL, but a n o t h e r EVAL w i l l . EVAL i s a u s e f u l command when t h e u s e r i s n o t s u r e whether o r not t h e b r e a k w i l l p r o d u c e t h e c o r r e c t v a l u e and w i s h e s t o be a b l e t o do s o m e t h i n g a b o u t i t i f i t i s wrong. RETURN form The f o r m i s e v a l u a t e d and i t s v a l u e i s r e t u r n e d a s t h e v a l u e o f t h e b r e a k . F o r example, one might RETURN (REVERSE BREAKVALUE). FROM f o r m T h i s p e r m i t s t h e u s e r t o r e l e a s e t h e b r e a k and r e t u r n t o a p r e v i o u s c o n t e x t w i t h f o r m t o be e v a l u a t e d . F o r d e t a i l s s e e c o n t e x t commands. USE e x p r F o r use e i t h e r w i t h UNDEFINED ATOM e r r o r o r UNDEFINED FUNCTION e r r o r . R e p l a c e s t h e e x p r e s s i o n ( u s i n g RPLACA, t h e change i s permanent) c o n t a i n i n g t h e e r r o r w i t h e x p r (not t h e v a l u e o f expr) e . g . , + ***16 UNDEFINED ATOM + Q HQ * 1 : CAR BROKEN = USE XX Changes Q t o XX i n t h e form (CAR Q ) , which, i n t h e above example, c a u s e d t h e e r r o r . I A b o r t s t h e b r e a k . T h i s i s a u s e f u l way t o unwind t o a h i g h e r l e v e l b r e a k . A l l o t h e r e r r o r s , i n c l u d i n g t h o s e e n c o u n t e r e d w h i l e e x e c u t i n g t h e GO, OK, EVAL and RETURN commands, m a i n t a i n t h e b r e a k . I I T h i s r e t u r n s c o n t r o l d i r e c t l y t o t h e t o p l e v e l o f L I S P . ARGS { P r i n t s t h e names and t h e c u r r e n t v a l u e s o f t h e arg u m e n t s o f t h e f u n c t i o n a t BREAKPOINTER. In most c a s e s , t h e s e a r e t h e a r g u m e n t s o f t h e b r o k e n f u n c t i o n . HELP C a u s e s a b r i e f d e s c r i p t i o n o f t h e b r e a k package commands t o be l i s t e d on t h e u s e r ' s t e r m i n a l . <FORM> i s EVALed i f n o t a b r e a k command. Context_Commands A l l i n f o r m a t i o n p e r t a i n i n g t o t h e e v a l u a t i o n o f f o r m s i n LI S P i s k e p t on t h e push down s t a c k . Whenever a form i s e v a l u a t e d , t h e form i s p l a c e d on t h e push down s t a c k . Whenever a v a r i a b l e i s bound, t h e o l d b i n d i n g i s s a v e d on t h e push down s t a c k . The c o n t e x t (the b i n d i n g s o f f r e e v a r i a b l e s ) o f a f u n c t i o n i s d e t e r m i n e d by i t s p o s i t i o n i n t h e s t a c k . When a b r e a k o c c u r s , i t i s o f t e n u s e f u l t o e x p l o r e t h e c o n t e x t s o f o t h e r f u n c t i o n s on t h e s t a c k . BREAKFUNCTION a l l o w s t h i s by means o f a c o n t e x t p o i n t e r , BREaKPOINTER, which i s a p o i n t e r i n t o t h e push down s t a c k . BREAKFUNCTION c o n t a i n s commands t o move t h e c o n t e x t p o i n t e r and t o e v a l u a t e atoms o r e x p r e s s i o n s r e l a t i v e t o t h e i r p o s i t i o n s i n t h e s t a c k . F o r t h e p u r p o s e o f t h i s document, when moving t h r o u g h t h e s t a c k , " b a c k w a r d " i s c o n s i d e r e d t o be toward t h e t o p l e v e l o r , e q u i v a l e n t l y , t o w a r d s t h e o l d e r f u n c t i o n c a l l s on t h e s t a c k . F arg1 arg2 ... argN R e s e t t h e v a r i a b l e BREAKPOINTER, which e s t a b l i s h e s a c o n t e x t f o r t h e commands USE, ARGS, AT, FROH and t h e b a c k t r a c e commands d e s c r i b e d b elow. BREAKPOINTER i s t h e p o s i t i o n o f a f u n c t i o n c a l l on t h e push down l i s t . I t i s i n i t i a l i z e d t o t h e f u n c t i o n j u s t b e f o r e t h e c a l l t o BREAKFUNCTION. F t a k e s t h e r e s t o f t h e l i n e a s i t s l i s t o f a r g u m e n t s . Numbers I f p o s i t i v e , move BREAKPOINTER back ( i . e . t o w a r d s t h e t o p l e v e l ) t h a t number o f c a l l s . I f n e g a t i v e , f o r w a r d . Example: I f t h e push-down s t a c k l o o k s l i k e FOp SETQ COND PROG F I E COND F I E COND F I E COND PROG FUN BREAKFUNCTION (13) (12) (11) (10) (9) (8) (7) (6) (5) (4) (3) (2) ( D Then F F I E COND F COND F 2 TOP w i l l s e t BREAKPOINTER t o (7) w i l l t h e n s e t BREAKPOINTER t o (5) w i l l t h e n move BREAKPOINTER t o (3) w i l l r e s e t BREAKPOINTER t o (12) *»2 F c a n be used on BREAKCMDS. In t h a t c a s e , t h e n e x t e l e m e n t o f t h e l i s t i s t r e a t e d a s t h e l i s t o f a r g u m e n t s t o F, ( e . g . (F (FOO F I E FOO)) TOP TOP r e p o s i t i o n s BREAKPOINTER t o a s t a c k p o s i t i o n j u s t p r i o r t o BREAKFUNCTION EDIT a r g 1 a r g 2 ... a r g n EDIT u s e s i t s a rguments t o r e s e t BREAKPOINTER i n t h e same manner as t h e F command. The form a t BREAKPOINTER i s t h e n g i v e n t o EDITE. T h i s command c a n o f t e n s a v e t h e u s e r t h e t r o u b l e o f c a l l i n g EDITF and f i n d i n g t h e e x p r e s s i o n t h a t he needs t o e d i t . I f t h i s command i s n o t used, t h e e d i t o r need n o t be i n memory. T h i s command w i l l c a u s e an e r r o r (a new b r e a k l e v e l ) i f t h e e d i t o r i s n o t i n c o r e when i t i s e n t e r e d . AT a r g 1 a r g 2 ... argN T h i s command i s u s e d t o d i s p l a y t h e v a l u e s o f v a r i a b l e s a t p o s i t i o n BREAKPOINTER. I f t h e u s e r t y p e s : AT X (CAR Y) he w i l l s e e t h e v a l u e o f X, and t h e v a l u e o f (CAR Y ) . The d i f f e r e n c e between u s i n g AT and t y p i n g X and (CAR Y) d i r e c t l y i n t o BREAKFUNCTION i s t h a t AT e v a l u a t e s i t s i n p u t s as o f BREAKPOINTER. T h i s p r o v i d e s a way o f e x a m i n i n g v a r i a b l e s o r f o r m s a t a p a r t i c u l a r p o i n t on t h e s t a c k . F o r example, F FCO 1 FOO AT X w i l l a l l o w t h e u s e r t o examine t h e v a l u e o f X i n an e a r l i e r c a l l t o FOO. AT c a n a l s o be us e d on BREAKCMDS, i n which c a s e t h e n e x t e l e m e n t o f t h e l i s t on BREAKCMDS i s t r e a t e d a s t h e l i s t o f a r g u m e n t s . F o r example, i f BREAKCMDS i s (EVAL AT (X (CAR Y)) GO), BREAKEXPR w i l l be e v a l u a t e d , t h e v a l u e s o f X and (CAR Y) p r i n t e d , and t h e n t h e f u n c t i o n e x i t e d w i t h i t s v a l u e b e i n g p r i n t e d . FROM [ f o r m ] FROM e x i t s t h e b r e a k by u n d o i n g t h e push down s t a c k back t o BREAKPOINTER. I f form i s m i s s i n g , r e - e v a l u a t i o n c o n t i n u e s w i t h t h e f o r m on t h e push down s t a c k a t BREAKPOINTER. I f form i s n o t m i s s i n g , t h e f u n c t i o n c a l l on t h e push down s t a c k a t BREAKPOINTER i s r e p l a c e d by form and e v a l u a t i o n c o n t i n u e s w i t h f o r m . Form i s e v a l u a t e d i n t h e c o n t e x t o f 43 BREAKPOINTER. T h e r e i s no way o f r e c o v e r i n g t h e b r e a k b e c a u s e t h e push down s t a c k has been undone. FROM, among o t h e r t h i n g s , a l l o w s t h e u s e r t o r e t u r n a p a r t i c u l a r v a l u e as t h e v a l u e o f any f u n c t i o n c a l l on t h e s t a c k . To r e t u r n 1 a s t h e v a l u e o f t h e p r e v i o u s c a l l t o FOO: :F FOO :FROM 1 Backtracg_commands The b a c k t r a c e commands p r i n t i n f o r m a t i o n a b o u t f u n c t i o n c a l l s on t h e push down l i s t . The i n f o r m a t i o n i s p r i n t e d i n r e v e r s e o r d e r t o t h a t i n which c a l l s were made. A l l b a c k t r a c e s s t a r t a t BREAKPOINTER. BKF BKF g i v e s a b a c k t r a c e o f t h e CARs o f f o r m s t h a t a r e s t i l l p e n d i n g . BKE g i v e s a b a c k t r a c e o f t h e e x p r e s s i o n s which c a l l e d f u n c t i o n s s t i l l p e n d i n g ( i . e . i t p r i n t s t h e f u n c t i o n c a l l s t h e m s e l v e s i n s t e a d o f o n l y t h e names a s i n B K F ) . BK g i v e s a f u l l b a c k t r a c e o f a l l e x p r e s s i o n s s t i l l p e n d i n g . I t e v a l u a t e s t h e form (DUMP 0 ) . O u t p u t i s i n t h e f o r m : f u n c t i o n name l i s t o f arguments f u n c t i o n name l i s t o f a r g u m e n t s BKF and BKE may be f o l l o w e d by an i n t e g e r . I f t h e i n t e g e r i s i n c l u d e d , i t s p e c i f i e s how many b l o c k s a r e t o be p r i n t e d . The l i m i t i n g p o i n t o f a b l o c k i s a f u n c t i o n c a l l . T h i s f o r m i s u s e f u l when w o r k i n g on a 3270. U s i n g t h e i n t e g e r f e a t u r e i n c o n j u n c t i o n w i t h t h e F command, which moves BREAKPOINTER, t h e u s e r c a n d i s p l a y any c o n t i g u o u s p a r t o f t h e b a c k t r a c e . Example: BKF would p r i n t t h e names o f t h e f u n c t i o n s c a l l e d b e f o r e BREAKPOINTER. 4i» BREAK PACKAGE How t o _ s e t _ a „ B r e a k The f o l l o w i n g f u n c t i o n s a r e u s e f u l f o r s e t t i n g and u n s e t t i n g b r e a k s and t r a c e s . B o th BREAKF and TRACE use a f u n c t i o n BREAKO t o do t h e a c t u a l m o d i f i c a t i o n o f f u n c t i o n d e f i n i t i o n s . BREAKF BREAKF i s an FLAMBDA. F o r e a c h a t o m i c argument, i t b r e a k s t h e f u n c t i o n named e a c h t i m e i t i s c a l l e d . F o r e a c h l i s t o f t h e form (FN 1 IN F N 2 ) , i t b r e a k s o n l y t h o s e o c c u r r e n c e s o f FN 1 which a p p e a r i n FN2. T h i s f e a t u r e i s v e r y u s e f u l f o r b r e a k i n g a f u n c t i o n t h a t i s c a l l e d f r o m many p l a c e s , b u t where one i s o n l y i n t e r e s t e d i n t h e c a l l f r o m a s p e c i f i c f u n c t i o n , e.g. (RPLACA IN F C C ) , (PRINT IN F I E ) , e t c . F o r each l i s t n o t i n t h i s f o r m , i t assumes t h a t t h e CAR i s a f u n c t i o n t c be b r o k e n ; t h e CADR i s t h e b r e a k c o n d i t i o n ; (when t h e f u n c t i o n i s c a l l e d , t h e b r e a k c o n d i t i o n i s e v a l u a t e d . I f i t r e t u r n s a non-NIL v a l u e , t h e b r e a k o c c u r s . O t h e r w i s e c o m p u t a t i o n c o n t i n u e s w i t h o u t break.) and t h e CADDR i s a l i s t o f command l i n e s t o be p e r f o r m e d b e f o r e an i n t e r a c t i v e b r e a k i s made ( s e e BREAKWHEN and BREAKCMDS o f BREAKFUNCTION) o r NIL. F o r example,' (BREAKF F0O1 (F002 (GREATERP N 5) (ARGS) ) ) w i l l b r e a k a l l c a l l s t o F001 and a l l c a l l s t o F002 when N i s g r e a t e r t h a n 5 a f t e r f i r s t p r i n t i n g t h e a r g u m e n t s o f F002. (BREAKF ((F004 IN F005) (MINOSP X) NIL)) w i l l b r e a k a l l c a l l s t o FOO1* made f r o m F005 when X i s n e g a t i v e . E x a m p l e s : (BREAKF FOO) (BREAKF ((GET IN FOO) T (GO))) (BREAKF { (SETQ IN FIE) (EQ N 1) ( (PRINT (QDOTE N=1)) AT (M) ) ) ) TRACE TRACE i s an FLAMBDA. F o r e a c h a t o m i c argument, i t t r a c e s t h e f u n c t i o n named e a c h t i m e i t i s c a l l e d . F o r each l i s t i n t h e form (FN 1 IN FN2), i t t r a c e s o n l y t h o s e c a l l s t o FN 1 t h a t o c c u r w i t h i n FN2. F o r example, (TRACE F001 (SETQ IN F003)) w i l l c a u s e b o t h FOO1 and SETQ i n F003 t o be t r a c e d . N o t e : The u s e r c a n a l w a y s c a l l BREAKO h i m s e l f t o o b t a i n c o m b i n a t i o n s o f o p t i o n s o f BREAKFUNCTION not d i r e c t l y a v a i l a b l e w i t h BREAKF and TRACE (see s e c t i o n on BREAKO b e l o w ) . T h e s e f u n c t i o n s m e r e l y p r o v i d e c o n v e n i e n t ways o f c a l l i n g BREAKO, and w i l l s e r v e f o r most u s e s . as UNBREAK UNBREAK i s an FLAMBDA. I t t a k e s a l i s t o f f u n c t i o n s m o a i f i e d by BBEAKF o r TRACE and r e s t o r e s them t o t h e i r o r i g i n a l s t a t e . I t s v a l u e i s NIL. (UNBREAK T) w i l l u n b r e a k t h e f u n c t i o n most r e c e n t l y b r o k e n . (UNBREAK) w i l l u n b r e a k a l l o f t h e f u n c t i o n s c u r r e n t l y b r o k e n ( i . e . a l l t h o s e on BROKENFN). I f one o f t h e f u n c t i o n s f n i s n o t b r o k e n , UNBREAK p r i n t s f n NOT BROKEN f o r t h a t f u n c t i o n and no c h a n g e s a r e made t o f n . UNTRACE UNTRACE i s an FLAMBDA. I t i s t h e s i m i l a r t o UNBREAK. \ 46 BREAKO [EN WHEN COMS] BREAKO i s an EXPB. I t s e t s up a b r e a k on t h e f u n c t i o n FN by r e d e f i n i n g FN a s a c a l l t o BREAKFUNCTION w i t h BREAKEXPR a form e q u i v a l e n t t o t h e d e f i n i t i o n o f FN, and WHEN, FN and COHS as BREAKWHEN, BREAKFN, and BREAKCMDS, r e s p e c t i v e l y {see BREAKFUNCTION). BREAKO a l s o adds FN t o t h e f r o n t o f t h e l i s t BRCKENFNS. I t s v a l u e i s FN. I f FN i s n o n - a t o m i c and o f t h e fo r m (fn1 IN fn2) , BREAKO f i r s t c a l l s a f u n c t i o n which c h a n g e s t h e name o f f n 1 wherever i t a p p e a r s i n s i d e o f f n 2 t o t h a t o f a new f u n c t i o n , f n 1 - I N - f n 2 , which i s i n i t i a l l y d e f i n e d a s f n 1 . Then BREAKO p r o c e e d s t o b r e a k on f n 1 - I N - f n 2 e x a c t l y a s d e s c r i b e d a b o v e . T h i s p r o c e d u r e i s u s e f u l f o r b r e a k i n g on a f u n c t i o n t h a t i s c a l l e d f r o m many p l a c e s , b u t where one i s o n l y i n t e r e s t e d i n t h e c a l l f r o m a s p e c i f i c f u n c t i o n , e.g. (RPLACA 18 FOO), (PRINT IN F I E ) , e t c . T h i s o n l y works i n i n t e r p r e t e d f u n c t i o n s . 47 ERROR PACKAGE I n t r o d u c t i o n When an e r r o r o c c u r s d u r i n g t h e e v a l u a t i o n o f a LISP e x p r e s s i o n , c o n t r o l i s t u r n e d o v e r t o t h e E r r o r P a c k a g e . The i d e a b e h i n d t h e e r r o r p a c k a g e i s t h a t i t may be p o s s i b l e t o ' p a t c h up' t h e form i n which t h e e r r o r o c c u r r e d and c o n t i n u e . Or, a t l e a s t , t h a t you c a n f i n d t h e c a u s e o f t h e e r r o r more e a s i l y i f you c a n examine t h e s t a t e o f t h e w o r l d a t t h e t i m e o f t h e e r r o r . B a s i c a l l y , what t h e E r r o r Package does i s c a l l BREAKFUNCTION w i t h BREAKEXPR s e t t o t h e f o r m i n which t h e e r r o r o c c u r r e d . T h i s p u t s t h e u s e r ' i n a b r e a k * a r o u n d t h e form i n which t h e e r r o r o c c u r r e d . BREAKFUNCTION a c t s j u s t l i k e t h e t o p l e v e l o f t h e i n t e r p r e t e r w i t h some added commands (see s e c t i o n on BREAKFUNCTION). The main d i f f e r e n c e when i n t h e E r r o r P ackage i s t h a t t h e v a r i a b l e b i n d i n g s t h a t were i n e f f e c t when t h e e r r o r o c c u r r e d a r e s t i l l i n e f f e c t . F u r t h e r m o r e , t h e e x p r e s s i o n s t h a t were i n t h e p r o c e s s o f e v a l u a t i o n a r e s t i l l p e n d i n g . W h i l e i n t h e E r r o r P a c k a g e , v a r i a b l e s may be examined o r c h a n g e d , and f u n c t i o n s may be d e f i n e d o r e d i t e d j u s t a s i f you were a t t h e t o p l e v e l . In a d d i t i o n , t h e r e a r e s e v e r a l ways i n which you c a n a b o r t o r c o n t i n u e f r o m t h e p o i n t o f e r r o r . I n p a r t i c u l a r , i f you can p a t c h up t h e e r r o r , you c a n c o n t i n u e by t y p i n g OK. I f you c a n ' t p a t c h t h e e r r o r , | w i l l g e t you o u t o f t h e b r e a k . When you a r e i n t h e e r r o r p a c k a g e , t h e prompt c h a r a c t e r i s »=* and i s p r e c e d e d by a l e v e l number. N o t e : i f f o r some r e a s o n you d o n ' t want t h e e r r o r p a c k a g e i n v o k e d , i t c a n be t u r n e d o f f by e v a l u a t i n g (ERRORPACKAGE O F F ) . S i m i l a r l y (ERRORPACKAGE ON) w i l l t u r n t h e e r r o r p a c k a g e back on. i 48 T a b l e I Break Package Command Summary A c t i o n E v a l u a t e s BREAKEXPR, p r i n t s i t s v a l u e , and c o n t i n u e s w i t h t h i s v a l u e Same a s GO b u t no p r i n t o f v a l u e R e - e v a l u a t e BREAKEXPR and p r i n t i t s v a l u e . I t s v a l u e i s bound t o BREAKVALUE E v a l u a t e xx and c o n t i n u e w i t h i t s v a l u e E x cape one l e v e l o f BREAKFUNCTION E s c a p e t o t h e t o p l e v e l A f t e r an e r r o r , use e x p r f o r t h e e r r i n g atom C o n t i n u e s by r e - e v a l u a t i n g f o r m a t BREAKPOINTER R e s e t s BREAKPOINTER ( s t a c k c o n t e x t ) S e t s BREAKPOINTER t o t h e f u n c t i o n j u s t b e f o r e BREAKFUNCTION. R e s e t s BREAKPOINTER and g i v e s t h e form a t BREAKPOINTER t o t h e L I S P E d i t o r E v a l u a t e s f o r m f l as o f BREAKPOINTER P r i n t s a r guments o f t h e f u n c t i o n a t BREAKPOINTER B a c k t r a c e F u n c t i o n Names B a c k t r a c e F u n c t i o n C a l l s 49 BK B a c k t r a c e E x p r e s s i o n s N o te: BKE ana BKF can be f o l l o w e d by an i n t e g e r . The i n t e g e r w i l l l i m i t t h e t r a c e t o t h a t number o f b l o c k s . F o r example, BK, BKE, BKF 5 ana BKE 4 a r e a l l l e g i t i m a t e commanas. 50 A SAMPLE DEBUGGING SESSION The f o l l o w i n g i s a somewhat c l u m s y a t t e m p t t o w r i t e a program which r e t u r n s a l i s t o f a l l t h e atoms which a r e n o t s y s t e m f u n c t i o n s i n a g i v e n s t r u c t u r e . The e r r o r p a c k a g e , b r e a k p a c k a g e , and e d i t o r a r e u s e d t o debug t h e program. *<DEFUN ATMS (X) (ATOMCOLLECT (GET XX EXPR> > ATMS *<DEFUN ATOMCOLLECT (MAPC '<LAMBDA (X) (COND < ( ( (ATOM X) *(COND ((GETL X (FSUBH NSUBR) ) NILL) ( (T (SETQ ATOMS *(CONS X ATOMS> (T (ATOMCOLLECT X> X> > ATOMCOLLECT *(PRETTYPRINT ATMS ATOMCOLLECT) > (LAMBDA (X) > (ATOMCOLLECT (GET XX EXPR))) > (LAMBDA > (MAPC > (QUOTE > (LAMBDA (X) > (COND > ((((ATOM X) > (COND ((GETL X (FSUBR NSUBR)) NILL) > ( > (T > (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) ) ) > (T (ATOMCOLLECT X ) ) ) ) ) > X) ) > NIL He e n t e r t h e program and p r e t t y p r i n t i t . The e r r o r p a c k a g e i s on s o we t r y t h e program. * (ATMS ATOMCOLLECT) + + ***16 UNDEFINED ATOM + ATOMCOLLECT >1 : ATMS BROKEN T h e r e i s an e r r o r . B e c a u s e ATMS i s an EXPR, i t s argument i s e v a l u a t e d . We use t h e e r r o r p a ckage t o l o o k a t t h e s t a t e o f t h e w o r l d and d e c i d e t o use t h e e d i t o r t o c h a n g e ATMS to an NEXPR. = BKF >1 : ATMS = l I > ** TOP ** * (EDITF ATMS) :EDITING ATMS :(LAMBDA (X) (ATOMCOLLECT S)) .INSERT NLAMBDA FOR LAMBDA 1 : (NLAMBDA (X) (ATOMCOLLECT &) ) .OK > NIL 51 We have changed t h e f u n c t i o n ATMS w i t h t h e e d i t o r and we t r y i t a g a i n . •(ATMS ATOMCOLLECT) + • ***16 UNDEFINED ATOM + XX >1 : GET BROKEN = BKE >1 : (GET XX EXPR) >1 : (ATOMCOLLECT (GET XX EXPR)) >1 : (ATMS ATOMCOLLECT) = USE X = BKE 1 >1 : (GET X EXPR) = FROM We e n c o u n t e r an e r r o r i n t h e f u n c t i o n ATMS. X was a c c i d e n t l y e n t e r e d a s XX. We use t h e BKE command t o f i n d o u t where we a r e i n t h e e x e c u t i o n , and t h e USE command t o change t h e e r r i n g atom. We d o n ' t need t o use t h e e d i t o r h e r e . The BKE 1 i s u s e d t o v e r i f y t h e change and t h e FROM command w i l l r e s t a r t t h e e x e c u t i o n o f t h e GET. + + •••16 UNDEFINED ATOM + EXPR >1 : GET BROKEN =USE 'EXPR = BKE >1 : (GET X (QUOTE EXPR)) >1 : (ATOMCOLLECT (GET X (QUOTE EXPR))) >1 : (ATMS (ATOMCOLLECT) = FROM T h i s t i m e , we f i n d t h a t we f o r g o t t o q u o t e t h e EXPR. The e r r o r message t e l l s us t h a t EXPR i s b e i n g EVALed. A g a i n , we c a n make use o f t h e USE command t o change t h e f u n c t i o n and a v o i d h a v i n g t o use t h e e d i t o r . Note, t h e argument t o USE need n o t be a t o m i c . The FROM w i l l r e s t a r t us a t t h e GET. + + ***3 TOO FEW ARGUMENTS >1 : ATOMCOLLECT BROKEN = ARGS >1 : MAPC = (LAMBDA (MAPC (QUOTE (LAMBDA (X) (COND ( ( ( ( >1 : ATOM X) (COND ( (GETL X (FSUBR NSUBR)) NILL) < (T SETQ >1 :ATOMS (CONS X A T O M S ) ) ) ) ) ) ) ) (T (ATOMCOLLECT X ) ) ) ) ) X)) >1 : (QUOTE (LAMBDA (X) (COND ((((ATOM X) (COND ((GETL X ( >1 :FSUBR NSUBR)) NILL) ( (T (SETQ ATOMS (CONS X ATOMS))))) >1 : ) ) ) (T (ATOMCOLLECT X ) ) ) ) ) = (LAMBDA (X) (COND ((((ATOM >1 :X) (COND ((GETL X (FSUBR NSUBR)) NILL) ( (T (SETQ ATOMS ( >1 :CONS X A T O M S ) ) ) ) ) ) ) ) (T ATOMCOLLEXT X ) ) ) ) >1 : X = ATOMCOLLECT S o m e t h i n g i s v e r y wrong! We t r y t o p r i n t t h e ar g u m e n t s t o ATOMCOLLECT and g e t g a r b a g e . We use t h e e d i t o r a g a i n t o f i x t h e 52 d e f i n i t i o n o f ATOMCOLLECT. =(EDITF ATOMCOLLECT) :EDITING ATOMCOLLECT : (LAMBDA (MAPC 8 X) ) .INSERT (X) AFTER LAMBDA 1 : (LAMBDA (X) (MAPC 8 X) ) .OK >1 : NIL = BKF >1 : ATOMCOLLECT >1 : ATMS =F ATMS =FROM A f t e r we i n s e r t t h e (X) i n t o ATOMCOLLECT, we need t o f i n d a s a f e p l a c e t o r e s t a r t t h e c o m p u t a t i o n . I t would p r o b a b l y be ok t o r e s t a r t a t t h e c a l l t o ATOMCOLLECT, b u t t o be s u r e , we r e p o s i t i o n BREAKPOINTER w i t h t h e F command a t t h e c a l l t o ATMS and use t h e FROM command t o r e s t a r t us t h e r e . • + ***17 UNDEFINED FUNCTION + (ATOM X) >(ATOM X) BROKEN =(EDITF ATOMCOLLECT) :EDITING ATOMCOLLECT :(LAMBDA (X) (MAPC & X)) .F COND : (COND (S) (T S) ) .2 : (6 (COND & 5) ) .PP : ( ( ( (ATOM X) : (COND ((GETL X (FSUBR NSUBR)) NILL) : ( (T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) ) ) .BO ATOM : PP : ( ( (ATOM X : (COND ((GETL X (FSUBR NSUBR)) NILL) : ((T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) ) ) .UNDO :BO UNDONE The p a r e n t h e s e s i n ATOMCOLLECT a r e v e r y wrong. We t r y t o use t h e BO command t o f i x them b u t use i t i n c o r r e c t l y . We undo c u r m i s t a k e and t r y a g a i n . .0 : (COND (6) (T S) ) .BO 2 : (COND (S) (T 8) ) . PP : (COND : (({ATOM X) : (COND ((GETL X (FSUBR NSUBR)) NILL) : ( (T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) ) 53 : (T (ATOMCOLLECT X) ) ) .BO 2 : PP : (COND : ((ATOM X) : (COND ((GETL X (FSUBR NSUBR) ) NIL) : ( ( T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) : (T (ATOMCOLLECT X ) ) ) .OK >1 : NIL He f i g u r e o u t how t o use t h e BO command and f i x ATOMCOLLECT. >1 : KBF + + ***16 UNDEFINED ATOM • KBF >2 : EVAL BROKEN = l A f t e r f i x i n g ATOMCOLLECT, we t r y t o p e r f o r m a BKF command b u t t y p e i t i n c o r r e c t l y . ' S i n c e t h e b r e a k package EVALs a l l non- command i n p u t , KBF i s EVALed a n d , o f c o u r s e , c a u s e s a new e r r o r b r e a k . The l e v e l number i s now 2. S i n c e t h i s i s o n l y a t y p i n g m i s t a k e , we c a n pop back t o t h e b r e a k we were w o r k i n g a t ( l e v e l 1) w i t h t h e I command. = BKF >1 : : (ATOM X) >1 : ((ATOM X) (COND ((GETL X (FSUBR NSUBR)) NILL) ( (T >1 : :(SETQ (CONS X A T O M S ) ) ) ) ) ) >1 -: COND >1 : : LAMBDA >1 ' : MAPC >1 : : ATOMCOLLECT >1 : : ATMS T h e r e i s a g r e a t d e a l o f g a r b a g e on t h e s t a c k . We a g a i n need t o f i n d a s a f e p l a c e t o r e s t a r t t h e c o m p u t a t i o n (we c o u l d a l w a y s s t a r t f r o m t h e b e g i n n i n g ) . We d e c i d e t h a t t h e COND i s a s a f e p l a c e so we r e p o s i t i o n t h e BREAKPOINTER p o i n t e r t h e r e and r e t u r n . =F COND = FROM + + ***17 UNDEFINED FUNCTION • FSUBR >1 : SUBR BROKEN = BKF >1 : : FSUBR >1 : GETL >1 . : COND >1 , : COND >1 : : LAMBDA >1 : MAPC >1 : I ATOMCOLLECT >1 : : ATMS = (EDITF ATOMCOLLECT) 54 :EDITING ATOMCOLLECT : (LAMBDA (X) (COND S &) ) .F FSUBR :(FSUBR NSUBR) .0 : (GETL X (FSUBR NSUBR)) .EMBED FSUBR IN (QUOTE *) : (GETL X (QUOTE S)) ,OK >1 : NIL =F GETL = FROM We f o r g o t t o q u o t e t h e l i s t (FSUBR NSUBR) s o FSUBR i s EVALed. We c a n n o t u s e t h e USE command h e r e b e c a u s e t h a t would r e p l a c e t h e CAR o f th e l i s t (FSUBR NSUBR) which i s n o t what we want. We use t h e e d i t o r t o make t h e c h a n g e . We c a n n o t s i m p l y use t h e FROM command b e c a u s e t h e t o p o f t h e s t a c k has t h e form (FSUBR NSUBR) on i t so we must r e s t a r t f r o m t h e GETL. + + ***16 UNDEFINED ATOM + NILL >1 : COND BROKEN =USE NIL = BKE >1 : (COND ((GETL X (QUOTE (FSUBR NSUBR))) NIL) ( (T (SETQ >1 :ATOMS (CONS X ATOMS))))) >1 : (COND ((ATOM X) (COND ((GETL X (QUOTE (FSUBR NSUBR))) >1 :NIL) ((T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) (T ( >1 :ATOMCOLLECT X ) ) ) + + ***1 ATTN >2 : PRINT BROKEN = l The above e r r o r was c a u s e d by i n c o r r e c t l y t y p i n g NIL. We change i t w i t h t h e USE command and l o o k a t i t w i t h t h e BKE command. We d e c i d e t h a t t h e BKE w i l l p r i n t c u t more i n f o r m a t i o n t h a n we want t o see s o we i n t e r r u p t i t w i t h t h e a t t e n t i o n b u t t o n . T h i s c a u s e s a new b r e a k l e v e l . We pop back t o t h e o r i g i n a l e r r o r l e v e l w i t h t h e | command. The b r e a k i s on t h e COND and we c a n use t h e FROM command t o r e s t a r t . = FROM + + ***17 UNDEFINED FUNCTION + T > 1 : T BROKEN = BKE 1 >1 : (T (SETQ ATOMS (CONS X ATOMS))) = (EDITF ATOMCOLLECT) :EDITING ATOMCOLLECT , : (LAMBDA (X) (COND 6 &) ) .PP : (LAMBDA (X) : (MAPC 55 (QUOTE (COND ((ATOM X) (COND ( (GET1 X (QOOTE (FSOBB NSUBR))) NIL) ((T (SETQ ATOMS (CONS X A T O M S ) ) ) ) ) ) (T (ATOMCOLLECT X ) ) ) ) ) ) X)) F COND (COND (5 S) (T S)) 2 F COND COND (8 NIL) {&)) BO -1 (COND (5 NIL) (T &) ) .OK >1 : NIL = BKF >1 : T >1 : : COND >1 • : COND >1 : LAMBDA >1 • : MAPC >1 : : ATOMCOLLECT >1 : COND >1 : : LAMBDA >1 ' : MAPC >1 , : ATOMCOLLECT >1 : ATMS We use t h e e d i t o r a g a i n t o f i x t h e p a r e n t h e s i s p r o b l e m i n ATOMCOLLECT. We u s e t h e BKF command t o f i n d a s a f e p l a c e t o r e s t a r t ( n o t e , ATOMCOLLECT i s r e c u r s i v e , t h e r e a r e 2 c a l l s on t h e s t a c k ) . The COND i s a s a f e p l a c e . We r e s t a r t t h e r e . =F COND = FBOM + » ***16 UNDEFINED ATOM + ATOMS >1 : CONS BBOKEN T h i s t i m e , t h e p r o b l e m i s t h a t i n t h e f u n c t i o n ATMS, we s h o u l d have s e t ATOMS t o NIL. We make t h e change t o ATMS and s e t ATOMS t o NIL and c o n t i n u e . = (EDITF ATMS) :EDITING ATMS : (NLAMBDA NIL (MAPC & X)) .1 (SETQ ATOMS NIL) AFTER 2 : PP : (NLAMBDA (X) : (SETQ ATOMS NIL) 56 : (ATOMCOLLECT (GET X (QUOTE E X P R ) ) ) ) .OK :1 : NIL = (SETQ ATOMS NIL) :1 : NIL = FROM 1 > NIL •ATOMS > ( X X ATOMCOLLECT T ATOMS X CONS ATOMS T NIL NSUBR > FSUBR X GETL X ATOM X MAPC X) We have f o u g h t o u r way t h r o u g h t h e program and f c u n d many b u g s . The program t e r m i n a t e s b u t doe s n o t g i v e t h e r i g h t answer. The f u n c t i o n CONS s h o u l d n o t be on t h e l i s t b u t i t i s . To f i n d o u t why, we set , a b r e a k p o i n t on t h e c a l l t o GETL i n s i d e ATOMCOLLECT. We want e x e c u t i o n t o s t o p when GETL has argument CONS. •(BREAKF ((GETL IN ATOMCOLLECT) (EQ X 'CONS) N I L ) ) ) > NIL • (ATMS ATOMCOLLECT) >1 : GETL-IN-ATOMCOLLECT BROKEN = X >1 : CONS = EVAL >1 : NIL = (EDITF ATOMCOLLECT) :EDITING ATOMCOLLECT : (LAMBDA (X) (COND 6 S) ) .F FSUBR : (FSUBR NSUBR) .INSERT SUBR AFTER NSUBR : (FSUBR NSUBR SUBR) .OK >1 : NIL When t h e b r e a k p o i n t i s r e a c h e d , e x e c u t i o n i s s t o p p e d . We e v a l u a t e X t o be s u r e t h a t we a r e a t t h e p l a c e we want t o be ( i t has t h e v a l u e CONS which i s what we wanted) and we e v a l u a t e t h e GETL. I t r e t u r n s NIL which i s n o t c o r r e c t . The r e a s o n i s t h a t we f o r g o t t o che c k f o r SUBRs. We use t h e e d i t o r t o f i x t h e pr o g r a m . We c a n now remove t h e b r e a k p o i n t and c o n t i n u e . = (UNBREAK) >1 : NIL =OK > NIL •ATOMS > ( X X ATOMCOLLECT T ATOMS X CONS ATOMS T NIL NSUBR > FSUBR X GETL GETL-IN-ATOMCOLLECT X ATOM X MAPC X) The l i s t i s s t i l l wrong b u t we s u s p e c t t h a t t h e i n c o r r e c t atoms were p l a c e d on i t b e f o r e t h e b r e a k we s e t . We e v a l u a t e t h e f u n c t i o n s a g a i n . •(ATOMS ATOMCOLLECT) ATOMS > NIL 57 > ( X X ATOMCOLLECT T ATOMS X ATOMS T NIL SUBR NSUBR > FSUBR X X X X) A l l seems w e l l . To make s u r e , we d e c i d e t o t r a c e t h e program on a s m a l l s t r u c t u r e so we c a n f o l l o w i t s e x e c u t i o n . * (TR > * (AT >1 >1 >1 >2 >2 >2 >2 >2 >2 >2 >2 >3 >3 >4 >H >H >3 >2 >1 > (SETQ ATOMS NIL) (ATOMCOLLECT ( ACE ATOMCOLLECT) DONE MS ATMS) -> ATOMCOLLECT X = (NLAMBDA (X) (QUOTE E X P R ) ) ) ) ATOMCOLLECT X = (X) ATOMCOLLECT = NIL ATOMCOLLECT X = (SETQ ATOMS NIL) ATOMCOLLECT = NIL ATOMCOLLECT X = (ATOMCOLLECT (GET X (QUOTE EXPR))) -> ATOMCOLLECT X = (GET X (QUOTE EXPR) ) -> ATOMCOLLECT X = (QUOTE EXPR) <-ATOMCOLLECT = NIL <-r ATOMCOLLECT = NIL <-ATOMCOLLECT = NIL <-ATOMCOLLECT = NIL NIL GET X -> <--> <--> The program works now. 58 BREAKPACKAGE INTERNAL FUNCTIONS The f o l l o w i n g i s a d e s c r i p t i o n o f t h e major f u n c t i o n s which c o m p r i s e t h e b r e a k p a c k a g e . BREAKO See d e s c r i p t i o n o f PACKAGE. BREAKO under BREAK BREAKONE BREAKBT p e r f o r m s one b r e a k command. The code f o r most o f t h e b r e a k commands can be f o u n d i n t h e SELECTQ which i s t h e body o f t h i s f u n c t i o n . p e r f o r m s t h e o p e r a t i o n s f o r t h e b a c k t r a c e commands BKF and BKE. BREAKFUNCTION BREAKEVAL p e r f o r m s t h e s e t u p o p e r a t i o n s f o r t h e b r e a k and e r r o r p a c k a g e . I t c a n be t h o u g h t o f a s t h e t o p l e v e l f u n c t i o n when a b r e a k i s i n e f f e c t . I t i s a l s o t h e READ EVAL PRINT l o o p o f t h e b r e a k package. i s t h e b r e a k package EVAL f u n c t i o n f o r t h e EVAL and EVALT commands. BREAKLEVEL used by TOP and when t h e b r e a k package i s f i r s t e n t e r e d . S e t s BREAKPOINTER. BREAKFF p e r f o r m s t h e F command o p e r a t i o n s moving BREAKPOINTER. BREAKEVALAT used b o t h by t h e AT command and by ARGS. I t s i m u l a t e s t h e e v a l u a t i o n o f f o r m s u s i n g t h e v a l u e s f r o m t h e f u n c t i o n DISPLAY i n s t e a d o f t h e v a r i a b l e v a l u e s . BREAKARGS ERRORPACKAGE p e r f o r m s t h e ARGS command o p e r a t i o n s . s e t s t h e e r r o r f o r m s t o t h e c a l l t o BREAKFUNCTION and s a v e s t h e o l d e r r o r f o r m s on BREAKF. BREAKSOB UNBREAK used by BREAKF, TRACE, UNBREAK and UNTRACE f o r m o d i f y i n g t h e f u n c t i o n d e f i n i t i o n s . t o g e t h e r w i t h UNBREAK 1 r e v e r s e s t h e a c t i o n s o f BREAKF and TRACE. I t u s e s BREAKSUB t o undo t h e s t r u c t u r a l c h a n g e s made t o t h e f u n c t i o n d e f i n t i o n s . TRACE l i k e BREAKF c h a n g e s t h e f u n c t i o n d e f i n i t i o n s t o be c a l l s t o BREAKFUNCTION. TRACE i n c l u d e s i t e m s t o be e v a l u a t e d which p r i n t t r a c e i n f o r m a t i o n and c o n t i n u e . BREAKEXCISE removes t h e b r e a k and e r r o r package f u n c t i o n s f r o m memory making t h e s p a c e a v a i l a b l e f o r 59 o t h e r u s e s . The b r e a k and e r r o r p a c kage f u n c t i o n may be f o u n d i n t h e f i l e CS:BREAK. 60 PRETTYPRINTING AND PROGRAM F I L E S F o u r f u n c t i o n s a r e p r o v i d e d f o r p r e t t y p r i n t i n g and f o r r e a d i n g and w r i t i n g f i l e s which c o n t a i n u s e r f u n c t i o n s . PRETTYPRINT T h i s i s an FLAMBDA which l o o k s on t h e p r o p e r t y l i s t o f i t s a t o m i c a r g u m e n t s f o r an EXPR, MACRO, o r BOG and p r e t t y p r i n t s them on •SOURCE*. Example: •(PRETTYPRINT FOO FIE) > (LAMBDA (X) > (CONS X X)) > (LAMBDA (Y) > (CAR (CADR Y) ) ) > NIL The two f u n c t i o n s FOO and F I E a r e p r e t t y p r i n t e d . DSKIN T h i s f u n c t i o n i s an FLAMBDA. I t s a r g u m e n t s a r e MTS f i l e names. F o r e a c h argument, a l l s - e x p r e s s i o n s a r e r e a d f r o m t h a t f i l e and EVALed. F o r e a c h f u n c t i o n d e f i n i t i o n , (DEFUN, DEFPRCP, o r DEFINE) t h e f u n c t i o n name i s p l a c e d on t h e p r o p e r t y l i s t o f t h e f i l e name. F o r e a c h s - e x p r e s s i o n which i s n o t a f u n c t i o n d e f i n i t i o n , t h e s - e x p r e s s i o n i s a l s o p l a c e d on t h e p r o p e r t y l i s t o f t h e f i l e name. A f t e r a DSKIN t h e r e i s u n d e r t h e p r o p e r t y FUNCTIONS t h e l i s t c f f u n c t i o n s and s -e x p r e s s i o n s r e a d so t h a t UPDATE c a n r e b u i l d t h e f i l e . E xample: • (DSKIN FOOFILE) > DONE •(GET 'FOOFILE 'FUNCTIONS) > (FOO F I E (SETQ C NIL) F0027) t I n t h e above example, 3 f u n c t i o n s and an s - e x p r e s s i o n were r e a d f r o m t h e f i l e FOOFILE. A l l were EVALed. DSKOUT DSKODT i s an FLAMBDA. I t t a k e s as arguments a f i l e name and a l i s t o f f u n c t i o n names and s - e x p r e s s i o n s . DSKOUT c a u s e s t h e f u n c t i o n s named and t h e s - e x p r e s s i o n s t o be p r e t t y p r i n t e d i n t o t h e named f i l e . E xample: •(DSKOUT FOOFILE F I E FOO (PUT 'A *B »C) BAR (SETQ «A N I L ) ) > DONE The f i l e FOOFILE w i l l c o n t a i n 1. The d e f i n i t i o n o f F I E . 2. The d e f i n i t i o n o f FOO. 3. The PUT. 61 4. The d e f i n i t i o n o f BAR. 5. The SETQ. UPDATE T h i s f u n c t i o n i s used when a f i l e was r e a d by DSKIN and t h e f u n c t i o n s o r s - e x p r e s s i o n s have been changed o r e x t e n d e d . I t t a k e s a s ar g u m e n t s a f i l e s p e c i f i e d i n a DSKIN and a l i s t o f f u n c t i o n names and s - e x p r e s s i o n s t o be i n c l u d e d w i t h t h e o r i g i n a l f i l e . F o r f i l e p r o t e c t i o n , t h e f u n c t i o n s and s - e x p r e s s i o n s a r e f i r s t p r e t t y p r i n t e d t o t h e f i l e -LISPTEMP t h e n c o p i e d t o t h e s p e c i f i e d f i l e . Example • (UPDATE FOOFILE (SETQ A NIL) ) #EMPTY -LISPTEMP tDONE #EMPTY FOOFILE • F I L E "FOOFILE" I S TO BE EMPTIED, PLEASE CONFIRM. #0K #COPY -LISPTEMP TO FOOFILE > DONE F o o f i l e now c o n t a i n s t h e u p d a t e d f u n c t i o n s and t h e SETQ. T h e s e f u n c t i o n s a r e f o u n d i n CS:DSKIO and a r e r e a d i n w i t h t h e e d i t o r . 62 BIBLIOGRAPHY R. Bobrow, R. B u r t o n , D. L e w i s , UCI LI S P MANUAL X U n i v e r s i t y o f C a l i f o r n i a , I r v i n e , O c t 1972. ~ J . M c C a r t h y , LISP US PROGRAMMERS MANUAL^ MIT P r e s s , 1962. W. T e i t e l m a n , D. G.~Bobrow, BBN^LISP~TEBEX REFERENCE MANUAL X E o l t B e r a n e k ana Newman Cambridge,~Mass.~19727~ B. W i l c o x , C. H a f n e r , LISP/MTS USER^S GUIDE X M e n t a l H e a l t h R e s e a r c h I n s t i t u t e , Ann A r b o r , M i c h . 1 9 7 3 7 (PROGN (UEFP80P BREAKF EXPR (FLAK6DA (BREAKARG) (OPEN (BREAKIN 60 *HSOURCE») (BREAKOUT 80)) (MAPC •• (QUOTE (LAMBDA (BREAKARG) (COHD ((OR (ATOM BREAKARG) (EQ (CADR BREAKARG) (QUOTE IN))) (BREAKO BREAKAHG T NIL)) (T (BREAKO (CAR BREAKARG) (CADR BREAKARG) (CADDR BREAKARG)))))) BREAKARG) (QUOTE DONE) ) ) (DEFPROP BREAKO EXPR (LAMBDA (BREAKFN BREAKWHEN BREAKCMDS) (PROG (BREAKA BREAKB BREAKC BREAKD) (COND ((HEMQ BREAKFN (GET (QUOTE BROKENFN) (QUOTE BROKENFN) ) ) (PRIN1 BREAKFN) (PRIH1 (QUOTE "ALREADY BROKEN")) (RETURN (TERPRI)))) (POT (QUOTE BROKENFN) (QUOTE BROKENFN) (CONS BREAKFN (GET (QUOTE BROKENFN) (QUOTE BROKEN FN) ) ) ) (COHD ( (ATOM BREAKFN) (SETQ BREAKA (GETL BREAKFN (QUOTE (EXPR PiACRO BUG) ) (QUOTE (PROGN (PRIH1 BREAKFN) (PRIN1 (QUOTE "NOT A FUNCTION")) (RETURN (TERPRI)))))) (RPLACA (CDDADR BREAKA) (LIST (QUOTE BREAKFUKCT ION) (CONS (QUOTE PROGN) (CONS (CAR (CDDADR BREAKA) ) (CDS (CCDACR BREAKA)))) BREAKWHEN BREAKFN BREAKCMDS (QUOTE BREAK))) (RPLACD (CDDADR BREAK A) NIL)) ((EQ (CADR BREAKFN) (QUOTE IN) ) (SETQ BREAKA (GETL (CADDR BREAKFN) (QUOTE (EXPR. MACRO BUG) ) (QUOTE (PROGN (PRIK1 (CADDR BREAKFN)) (PRINT (QUOTE "HAS KC FUNCTION")) (RETURN (TERPRI)))))) (SETQ BREAKB NIL) (BREAKSUB (SETQ BREAKC (f.KATOK (CAR BREAKFN) (QUOTE -IN-) (CADDR BREAKFN) ) ) (CDDADR BREAKA) (CAR BREAKFN)) (COUD ( (NULL BREAKB) (PR1N1 (QUOTE NO) ) (PRIN1 (CAR BREAKFH) ) (PRIN1 (QUOTE IN)) (PRIN1 (CADDR BREAKFN)) (RETURK (TERPRI)))) (SELECTQ (CAR (SETQ BREAKA (GETL . (CAR BREAKFN) (QUOTE (EXPR SUBR MACRO BUG FSUBR NSUBR)) (QUOTE (PROGN (TERPRI) (PRIN1 (CAR BR CAKFN)) (PR IN 1 (QUOTE " KOT FOUND")) (RETURN (T E R P R I ) ) ) ) ) ) ) ((EXPR MACRO BUG) (PUT BREAKC (CAR BREAKA) (CONS (CAAOR BREAKA) (COHS (CA DAR BREAKA) (CONS (CAR (CDDADR BREAKA)) (CDR (CEDADR BREAKA))))))) (SUES (SETQ BREAKD (LIST (QUOTE LAMBDA) (QUOTE BREAKCUntlY) (CONS (COND ( (ATOM BREAKB) BBEAKB) (T (CAR 6BEAKB)) ) NIL)) BREAKFN 0) (COND ((LISTP BREAKB) (REPEAT (QUOTE (PROGN (SETQ EREAKFN (ADD1 BREAKFN)) (KCONC (CADCR BREAKB) (LIST (LIST (QUOTE ARG) BREAKFN))))) (SDB1 (LENGTH BREAKB)))) (T (SETQ BREAKCMDS (CONS (QUOTE (PROGN (SETQ BREAKA (CADR BREAKEXPR) BREAKB 0) (REPEAT (QUOTE (PROGN (SETQ BREAKB (ADD1 BREAKB) ) (KCONC BREAKA (LIST (LIST (QUOTE ARG) BREAKB) ) ) ) ) (SUB1 BREAKDUMMY) ) ) ) BREAKCMDS)))) (PUT BREAKC (QUOTE EXPR) BREAKD) } ((NSUBR FSUBR) . . . (PUT BREAKC (QUOTE EXPR) (LIST (QUOTE FLAKBDA) (OOOTE (BREAKDUMMY)) (LIST (QUOTE APPLY) (LIST (QUOTE QUOTE) (CAR BREAKFN) ) (QUOTE BREAKDUMMY))!)) (NIL) ) (BREAKO BREAKC BREAKKHEN BREAKCMDS)) (T (MAPC (QUOTE (LAMBDA (UREAKARG) (BREAKO BREAKARG BREAKKHEN BREAKCMDS))) BREAKFN)))))) 65 (EIFPROP bREAKONE EXPR (LAMBDA N I L (SELECTQ (CAR BREAKCMDS) (GO (BREAKEVAL) (PRINT BREAKVALUE BREAKOUT) (UNEVAL (QUOTE BREAKFUNCTION) ( L I S T (QUOTE QUOTE) BREAKV ALUE) ) ) (OK (BREAKEVAL) (UNEVAL (QUOTE BREAKFUNCTION) ( L I S T (QUOTE QUOTE) EREA KV ALOE) ) ) (EVAL (SETQ BREAKVALUE (EVAL BREAKEXPR) EREAKFLAG T) (BREAKIO) (PRINT BREAKVALUE BREAKOUT)) (EVALT (SETQ BREAKVALUE (EVAL BREAKEXPR) BREAKFLAG T) (BREAKIC) ) (RETURN (COND ( (NULL (CADR BREAKCMDS)) (PRINT (QUOTE "RETURN WHAT?") BREAKOUT)) (T (SETQ BREAKA (EVAL (CADR EREAKCf.DS) ) ) (UNEVAL (QUOTE BREAKFUNCTION) ( L I S T (QUOTE QUOTE) B R E A K A ) ) ) ) ) (I (UHEVAL (QUOTE BREAKFUNCTION) (QUOTE (COND ( (NULL (UNEVAL (QUOTE BREAKONE)) ) (UNEVAL -1 (QUOTE (QUOTE " * * TOP * » " ) ) ) ) ( (UNEVAL (QUOTE BREAKONE) (QUOTE ( B R E A K I O ) ) ) ) ) ) ) ) (|| (UNEVAL -1 (QUOTE (QUOTE " * * TOP * * " ) ) ) ) (FROM (COND ( ( N U L L (CDR BREAKCMDS)) (UNEVAL BREAKPOINTER T ) ) ( (UNEVAL BREAKPOINTER (CADR B R E A K C M D S ) ) ) ) ) ' (USE (COND (( N U L L (CDR BREAKCMDS)) (PRINT (QUOTE "USE WHAT?") BREAKOUT)) ( (EQ BREAKT7PE (QUOTE BREAK)) (PRINT (QUOTE "NOT IN AN ERROR BREAK") BREAKOUT)) ((AND (EQ (STATUS SH) 68) (EQ (STATUS 53) (CAR (UNEVAL B R E A K P O I N T E S ) ) ) ) • (RPLACA (UNEVAL BR EAKPOI !JT ER) (CADR BREAKCMDS) ) ) ( (EQ (STATUS 51) 6<l) (BREAKSUB (CADR BREAKCMDS) (UNEVAL BREAKPOINTER) (STATUS 5 3 ) ) ) (T (PRINT (QUOTE "USE LEGAL KIT H UNDEFINED ATOM OR UNDEFINED FUNCTION ONLJ") BREAKOUT))) (SETQ BREAKCMDS (CDR E3EAKCMDS))) (ARGS (SETQ BREAKA (UNEVAL BREAKPOINTER)) (COND ((ATOM BREAKA) (EREAKARGS BREAKA)) ((ATOM (CAR BREAKA)) (EREAKARGS (CAP B R E A K A ) ) ) ( ( P R I N T (QUOTE "FUNCTION NAME NOT ATOMIC") B R E A K O U T ) ) ) ) (F (BREAKFF) (COh'D (BREAKECHO (SETQ BREAKCMDS N I L ) ) (T (SETQ BREAKCMDS (CDR B R E A K C M D S ) ) ) ) ) (TOP (fcREAKLEV EL) ) (EDIT (BREAKFF) (EDITE (UNEVAL BREAKPOINTER)) (COND (BREAKECHO (SETQ BREAKCMDS NIL)) (T (SETQ BREAKCMDS (CDR BREAKCMDS))))) (AT (MAPC (QUOTE (LAMBDA (BREAKARG) (PRINT (BREAKEVALAT BREAKARG) BREAKOUT))) (COND (BREAKECHO (CDR ER E AK CM DS) ) (T (CADR BREAKCMDS)))) • (COND.(BREAKECHO (SETQ BREAKCMDS NIL)) (T (SETQ BREAKCMDS (CCR BREAKCMDS))))) (BKF (COSD ( (NUMBER? (CADR BREAKCMDS)) (BREAKBT (CADR EREAKC'DS) (QUOTE CAR)) (SETQ BHEAKCKDS (CDR BREAKCMDS))) (T (BREAKBT (SUB 0 BREAKPOINTER) (QUOTE CAR))))) (BKE (COSD ((NUKBERP (CADR BREAKC.-.DS) ) (BREAKBT (CADR BREAKCMDS) (QOOTE NCONC)) (SETQ BREAKCMDS (CDR EREAKCMDS))) (T (BREAKBT (SUB 0 BREAKPOINTER) (QUOTE NCONC))))) (BK (DUMP 0)) (HELP (MTS (QUOTE "COPY CS:BREAK.HELP"))) (COND (BREAKECHO (PRINT (EVAL (CAR BREAKCMDS)) BREAKOUT)) ((EVAL (CAR BREAKCMDS))))))) (DEPPROP BREAKBT EXPR (LAMBDA (BREAKARG BREAKDO) (PROG NIL . (SETQ BREAKA BREAKPOINTER) (REPEAT (QUOTE (PROGN (COND ( (ATOM (SETQ BREAKB (UNEVAL BREAKA) ) ) (PRINT BREAKB BREAKOUT)) (T (PRINT (APPLY 1 BREAKCO BREAKE) BREAKOUT))) (SETQ BREAKA (ADD) BREAKA)))) BREAKARG)))) (DEFPROP BREAKFUNCTION EXPR (NLAMBDA (BriTlAKEXPR BREAK WHEN BREAKFN BREAKCMES BREAKTYPE) . (AND (EQ BREAKTYPE (QUOTE BREAK)) (NOT (EVAL BEEAKVHEII)) (RETURN (EVAL BREAKEXPR))) (PROG (BREAKLEVEL BREAKA BREAKB BREAKC BREAKTAB BREAKECHO BREAKVALUE BREAKFLAG BREAKPOINTER) (SETQ BREAKTAB 1) (AND (EQ BREAKTYPE (QUOTE ERROR)) (DUMP 1)) (SETQ BREAKLEVEL (COND <(E2 (SETQ BREAKA (DISPLAY BREAKPUKCTIOK B BREAKLEVEL)) (QUOTE *UNDEF*) ) 1) ((NOT (NUMBERP BREAKA)) 0) (T (ADD1 BREAKA)))) < B R £ A K I O ) (BREAKLEVEL) lOOPt (COND (BREAKCMDS (BREAKONE) (SETQ BREAKCMDS (CDR BREAKCMDS)) (GO LOOP1) ) ) (PRIN1 BREAKFK EREAKOUT) (PRIN1 (QUOTE " BROKEN") BREAKOUT) (SETQ BREAKECHO T) (TERPRI BREAKOUT) LOOP (COND (BREAKCMDS (BREAKONE) (SETQ BREAKCMDS (CDR BREAKCMDS))) (T (READLINE BR EA KIN NIL) (SETQ BREAKCMDS (BREAKREAD) ) ) ) • (GO LOOP) ) ) ) (DEFPROP BRZAKEVAL EXPR (LAMBDA NIL (COND ((NULL BREAKFLAG) (SF.TQ BREAKVALUE (EVAL BREAKEXPR) BREAKFLAG T) ) ) (BREAKIO))) (DEFPROP BREAKLEVEL EXPR (LAMBDA NIL (COND ((EQ (SETQ BREAKA (DISPLAY BREAKFUNCTION B BREAKPOINTER)) (QUOTE *UNI)EF*)) (SETQ BREAKA 0) ) ((NOT (NUMBER? BREAKA)) (SETQ BREAKA 0))) (REPEAT (QUOTE (PROGN (SETQ BREAKA (SUB1 BREAK A)) (CAR (UNEVAL (SUB! BREAKA))))) 10000 (QUOTE BREAKFUNCTION) ) (SETQ BREAKPOINTER (COND ( (EQ BREAKTYPE (QUOTE ERROR) ) (ADD1 BREAKA)) (T BREAKA)) ) ) ) (DEFPROP BREAKFF EXPR (LAMBDA NIL (SETQ BREAKA BREAKPOINTER) (KAPC (QUOTE (LAMBDA (BREAKARG) (COND {(NDMBERP BREAKARG) (COND ((NOT (MINUSP (SETQ BREAKB (ADD BREAKPOINTER BREAKARG)))) (PRINT (QUOTE "NUMBER TAKES YOU BEYOND THE TOP LEVEL") BREAKOUT) (UNEVAL (QUOTE BREAKFF) NIL)) (T (SETQ BREAKA BREAKB)))) IT (PROG NIL LOOP (COND ( (NULL (UNEVAL BREAK A) ) (PRI.N1 BREAKARG BREAKOUT) (PRIN1 (OUOTE "NOT FOUND") BREAKOUT) (TERPRI BREAKOUT) (UNEVAL (QUOTE BREAKFF) NIL)) ((EQ BREAKARG (UNEVAL BREAKA)) (RETURN NIL)) ((EQ BREAKARG (CAR (UNEVAL BREAKA))) (RETURN NIL))) (SETQ BREAKA (ADD1 BREAKA) ) • (GO LOOP) ) )) ) ) (COND (BREAKECHO (CDR EBEAKCMDS)) (T (CADR EREAKCMDS) ) ) ) (SETQ BREAKfOIKTER BREAKA))) (DEFPROP BREAKEVALAT EXFR (LAMBDA (BREAKARG) (COND ((AT0.1 BREAKARG) (APPLY 1 (QUOTE DISPLAY) (SUB1 BREAKPOINTER) (QUOTE B) BREAKARG)) ((EQ (CAR BHEAKASG) (QUOTE ARG)) (COND ((KDLL (CADR BREAKARG)) (PRINT (QUOTE "KISSING ARG ARGUMENT") BREAKOUT) (UNEVAL (QUOTE BREAKONE) NIL) ) ((NULL (CADDR BREAKARG)) (APPLT1 (QUOTE DISPLAY) (SUB1 EREAKPOINTER) • (CADR BREAKARG))) (T (APPLY 1 (QUOTE DISPLAY) (SUB 1 BREAKPOINTER) (CADR BREAKARG) (CADDR BREAKARG))))) ((GETL (CAR EREAKARG) (QUOTE (EXPR SUBR))) . (APPLY (CAR BREAKARG) (KAPCAR (QUOTE BREAKEVALAT) (CDR BREAKARG)))) (T (EVAL BREAKARG))))) (DEFPROP EREAKARGS EXPR (LAMBDA (BREAKARG) (SETQ BREAKB (CADADS (GETL BREAKARG (QUOTE (EXPR MACRO BOG)) (QUOTE (PROGN (PSIN1 (QUOTE "NO EXPR MACRO OB BUG FOR") BREAKOUT) (PR IN 1 BREAKARG BREAKOUT) (TERPRI BREAKOUT) (UNEVAL (QUOTE BREAKONE) N I L ) ) ) ) ) ) (COND ( (ATOM BREAKB) (SETQ BREAKC 0) (REPEAT (QUOTE (PROGN (SETQ BREAKC (A DDI BREAKC)) (TAB BREAKTAB BREAKOUT) (PRIiil (QUOTE "ARG «") BREAKOUT) (P8IH1 BREAKC BREAKOUT) (FRIS1 (QUOTE •'" = ") BREAKOUT) (PniNI (BREAKEVALAT (LIST (QUOTE APG) BREAKC BREAKS)) BREAKOUT) (TERPRI BREAKOUT))) (BREAKEVALAT BREAKS))) (T (MAPC (QUOTE (LAMBDA (BREAKARG) (TAB BREAKTAB BREAKOUT) (PRIH 1 BREAKARG BREAKOUT) (PRIN1 (QUOTE " = ") BKFAKOUT) (PR IK 1 (BREAKEVALAT BREAKARG) BREAKOUT) (TERPRI BREAKOUT))) B R E A K B ) ) ) ) ) (DEFPROP BREAKIO EXPR (LAMBDA S 1 L (STATUS (8 BREAKOUT NIL) (13 BREAKIN =)) (TAB 1 BREAKOUT) (PRIN1 BREAKLEVEL BREAKOUT) ( P R I t n (QUOTE :) BREAKOUT) (STATUS (8 BREAKOUT T) (11 BREAKIN B R E A K 1 S T E R C E P T ) ) ) ) (DEFPROP BREAKIKTERCEPT EXPR (LAMBDA (BREAKARG) (QUOTE »BREAKFLAC*))) (DEFPROP BREAKREAD EXPR (LAMBDA N I L (PROG (BREAKA BREAKB) LOOP (COND ( (EQ (SETQ BREAKA (READ BREAKIN)) (QUOTE *BREAKFLAG*)) (RETURN BREAKB)) (T (SETQ BREAKB (NCONC BREAKB ( L I S T B R E A K A ) ) ) (GO L O O P ) ) ) ) ) ) (DEFPROP ERRORPACKAGE EXPR (FLAMBDA (BREAKA) (PROG (BREAKB) (COND ( (EQ (CAR BREAKA) (QUOTE ON) ) (SETQ BREAKA 0) (REPEAT (QUOTE (SETQ BREAKB (CONS (APPLY 1 (QUOTE STATUS) ( L I S T 1 (SETQ BREAKA (SD01 BREAKA)) (QUOTE BREAKERROR) ) ) B R E A K B ) ) ) 39) (PUT (QUOTE BREAKF) (QUOTE BREAKF) BREAKB) NIL) ((EQ (CAR BREAKA) (QUOTE O F F ) ) (SETQ BREAKA 10) (MAPC (QUOTE (LAMBDA (BREAKB) (APPLY1 (QUOTE STATUS) ( L I S T 1 (SETQ BREAKA (SUB1 BREAKA) ) BREAKB) ) ) ) (GET (QUOTE BREAKF) (QUOTE B R E A K F ) ) ) ) (T (PRINT (QUOTE " W H A T ? " ) ) ) ) ) ) ) (DEFPROP BREAKSUB EXPR (LAMBDA (BREAKTO BREAK1NX BREAKFROM) (COND ( (ATOM BREAKINX) N I L ) ((EQ (CAR BREAKINX) BREAKFROM) (COND ( (NULL BREAKB) (SETQ BREAKB (CONS (CAR BREAKINX) (CDR B R E A K I N X ) ) ) ) ( (ATO.M BREAKB) ) ( (EQ (LEI.'KTII BREAKB) (LENGTH BREAKINX) ) ) (T (SETQ BREAKB BREAKFROt:) ) ) (RPLACA BREAKINX BREAKTO) (BREAKSUB BREAKTO (CDR BREAKINX) BREAKFROM)) (T (BREAKSDB BREAKTO (CAR BREAKINX) BREAKFROM) (BREAKSUB BREAKTO (CDR BREAKINX) BREAKFROM))))) (DEFPROP UNBREAK1 EXPR (LAMBDA (BREAKARG) (PROG (BREAKA BREAKB) (COND ((ATOM BREAKARG) (AND (KEQ (QUOTE BREAKFUNCTION) (CA ADR (SETQ BREAKA (CDADR (GETL BREAKARG (QUOTE (EXPR- MACRO BUG)) (QUOTE (PROGN (PR INI BREAKARG) (PRIK1 (QUOTE " NOT A FUNCTION")) (TERPRI) (RETURN NIL) ) ) ) ) ) ) ) (PRII11 BREAKARG) • (PRIH1 (QUOTE " NOT BROKEN")) (TERPRI) (RETURN NIL)) . (RPLACD BREAKA (CDR (CABADR BREAKA)))) ( (EQ (CADR BREAKARG) (QUOTE IN)) (BREAKSUB (CAR BREAKARG) (GETL (CADDR BREAKARG) (QUOTE (EXPR MACRO BUG)) (QUOTE (PROGN (PRII.'I (CADDR BREAKARG)) (PRIN1 (QUOTE " NOT A FUNCTION")) (TERPRI) (RETURN NIL) ) ) ) (MKRTOH (CAR BREAKARG) (QUOTE -IN-) (CADDR BREAKARG)))) (T (PR1H1 BREAKARG) (PRIN1 (QUOTE "?")) (TERPRI)))))) (DEFPROP UNBREAK EXPR (FLAMBDA (BREAKARG) (PROG NIL (COND ((NULL BREAKARG) (MAPC (QUOTE UNBREAK 1) (GET (QUOTE BROKENFN) (QUOTE EROKENPK) ) ) (REM (QUOTE BROKSNFN) (QUOTE BROKENFN))) ( (EQ (CAR BREAKARG) T) (DNBREAK1 (CAR (GET (QUOTE BROKENFN) (OUOTE BROKENFN)))) (PUT (QUOTE BROKENFN) (QUOTE BROKENFN) (CDR (GET (QUOTE BROKEN FN) (QUOTE BROKENFN))))) (T (MAPC (QUOTE (LABEL UNBREAKX (LAMBDA (BREAKARG) (MEMQ BREAKARG (GET (QUOTE BROKENFN) (QUOTE BROKENFN) (QUOTE (PROGN (PRIH1 BREAKARG) (PRIHl (QOOTE "NOT BROKEN") ) (TERPRI) (RETURN N I L ) ) ) ) ) (0NBREAK1 BREAKARG) (PUT (QUOTE BROKENFN) (QUOTE BROKENFN) (DELETE BREAKARG (GET (QUOTE EROKENFS) (QUOTE BROKENFN))))))) BREAKARG))) (QUOTE DONE) ) ) ) 1DEFPROP TRACE EXPR <FLAKBOA (BREAKARG) (PROG (BREAKA) (OPEN (BREAKIN 80 *HSOURCE*) (BREAKOUT 80)) (SETQ BREAKA (QUOTE ((SETQ BREAKTAB (ADD (REMAIN (TIMES (SUB1 BREAKLEVEL) 2) 30) 1)) (TAB (SOB BREAKTAB 3) BREAKOUT) (PRIN1 (QUOTE "->") BREAKOUT) (PRIN1 BREAKFN BREAKOUT) (TERPRI BREAKOUT) * ARGS EVALT (TAB (SUB BREAKTAB 3) BREAKOUT) (PRIN1 (QUOTE "<-") BREAKOUT) (PR IN1 BREAKFN BREAKOUT) (rRIBt (QUOTE " = ") BREAKOUT) (PRIN1 BREAKVALUE BREAKOUT) (TERPRI BREAKOUT) OK))) (MAPC (QUOTE (LAMBDA (BREAKARG) (COND ((ATOM BREAKARG) (BREAKO EREAKARGT BREAKA)) ((EQ (CADR BREAKARG) (QUOTE IN)) (BREAKO BREAKARG T BREAKA)) (T (BREAKO (CAR BREAKARG) (CADR BREAKARG) (NCONC (CADDR BREAKARG) BREAKA)))))) BREAKARG) (QUOTE DONE) ) ) ) (DEFPROP DNTRACE EXPR (FLAFiBDA (BREAKARG) (EVAL (CONS (QUOTE UNBREAK) BREAKARG)) (QUOTE DONE))) (DEFPROP BREAKEXCISE EXPR (LAMBDA NIL (ERRORPACKAGE OFF) (REM . (QUOTE (BREAKF BREAKO BREAKONE BREAKBT BREAKFUNCTION BREAKEVAL BREAKLEVEL BREAKFF BHEAKEVALAT ' ' BREAKARGS BREAKIO BREAKINTERCEPT BREAKREAD ERRORPACKAGE BREAKSUB UNBREAK1 UNBREAK TRACE UNTRACE BREAKEXCISE) ) (QUOTE EXPR)))! (SETQ BREAKERROR (QUOTE (£VAL (LIST (QUOTE BREAKFUNCTION) (PROGN (OPEN (BREAKIN 80 *KSOURCE*) (BREAKOUT 80)) (STATUS 53)) T (COND ({ATOM (UNEVAL 5)) (UNEVAL «)) (T (CAR (UNEVAL 5) ) ) ) NIL (QUOTE ERROR) ) ) ) ) (ERRORPACKAGE ON) '"BREAK LOADED") (PROGN (DEFPROP EDITF EXPR (FLAMBDA (EDITLIST) (OPEN (EDITIN 255 *SOURCE*) (EDITO0T 70 *SINK») (PHETTYBUFTER 70 *SINK*)) (STATUS (11 EDITIN EDITINTERCEPT) (5 EDITOUT T) (13 EDITIN ".") (13 EDITOUT :) (13 PRETTY BU FF ER :)) (MAPC (QUOTE (LAMBDA (EDITELE) (TERPRI EDITOUT) (PRIH1 (QUOTE "EDITING ") EDITOUT) (PRIK1 EDTTELE EDITOUT) (TERPRI EDITOUT) (EDITSTART (CADR (GETL EDITELE (QUOTE (EXPR MACRO BUG)) (OUOTE (PROGN (TERPRI EDITOUT) (PRIN1 EDITELE ED]TOUT) (PRIN1 (QUOTE " NOT FOUND") EDITOUT) (TERPRI EDITOUT) (UNEVAL (QUOTE EDITSTART) N I L 1 ) ) ) ) ) ) ) EDITLIST) ) ) (DEFPROP EDITNEXT EXPR (NLAMbDA (EDITFLAG) (READ EDITIN))) (DEFPROP EDITINTERCEPT EXPR (LAMBDA (EDXTDEY) (COND ((EQ EDITFLAG (QUOTE A)) (QUOTE * EDITFLAG*)) (EDITFLAG (EDITERR "MISSING SOMETHING")) (T (OR (HEMQ EDITLASTCOXMAND (QUOTE (P PP " ? " " ? ? " E TEST NIL UNBLOCK HELP))) (SETQ EDITLA5TCOMKAND NIL) (EDITONE (QUOTE P) ) ) (READLINE EDITIN NIL) NIL)))) (DEFPROP EDITSKASH EXPR (LAMBDA EDITARG (PROG (EDITA EDITCOUHT) (SETQ EDITA (LIST COMMA KD) EDITCOU NT 1) LOOP (AND (GREATERP EDITCOU NT EDITARG) (RETURN (SETQ EDITUNDOLIST (CONS EDITA ED1TUNDOL1ST)))) (NCONC EDITA (CONS (CONS (ARG EDITCOUNT) (CONS (CAR (ARG EDITCOUNT)) (CDR (ARG EDITCOUNT)))) NIL) ) (RPLACA (ARG EDITCOUNT) (ARG (ACD1 EDITCOUNT))) (RPLACD (ARG EDITCOUNT) (ARG (ADD EDITCOUNT 2))) (SETQ EDITCOUNT (ADD EDITCOU NT 3)) (GO LOOP) ) ) ) (DEFPROP EDITSTART EXPR (LAMBDA (EDITLIST) (PROG (EDITCHAIN LASTAIL EDITLASTCOMMAND TRETTYB PRETTYC PRETTYRP EDITDOT EDITDOTt EDITDOTS EDITAKP PRETTYLP PRETTYBL EDITLASTAIL EDITNEWUNPRINT EDITUNPRINT EDITUNDOLIST) (SETQ EDITCHAIN (CONS EDITLIST NIL) ) (SETQ EDITUNDOLIST (GET EDITELE (QUOTE *EDITFLAG»))) (PRETTYSF.TUP PRETTY BUFFER) (SETQ EDITDOT (COPY (QUOTE " . ") ) EDITDOTS (COPY (QUOTE " . . . » " ) ) EDITDOTS (COPY (QUOTE " ") ) EDITAMP (COPY (QUOTE "S") ) ) (SETQ PHETTYB 60) (EDITONE (QUOTE P) ) EDITLOOP (EDITTOP (SETQ EDITLASTCOKMAIID (EDITNEXT NIL))) (GO EDITLOOP) ) ) ) (DEFPROP EDITONE EXPR (LAMBDA (COMMAND) (PROG (EDITA EDITB EDITC EDITD EDITE EDITF) 7h (COHD ( (NOLL COMMAND) NIL) ((NUMEERP COMMAND) (COND ( (ZEROP COMMAND) (OR (CDR EDITCHAIN) (EDITERR "YOU'RE AT THE TOP")) (SETO EDITCHAIN (CDR EDITCHAIN))) ( (MINUSP COMMAND) (AND (GREATERP (MINOS COMMAND) (LENGTH (CAR EDITCHAIN) ) ) (EDITERR "TOO FEW ELEMENTS"))-(EDITONE (ADD 1 COMMAND (COND ( (ATOM (CAR EDITCHAIN) ) (EDITERR "CURRENT EXPRESSION IS AN ATOM")) ( (LENGTH (CAR EDITCHAIN))))))) (T (SETQ EDITA (CAR EDITCHAIN)) (SETQ EDITCHAIN (CONS (CAR (SETQ LASTAIL * (COHD ((ATOM EDITA). (EDITERR "CURRENT EXPRESSION IS AN ATOM")) ((SETQ EDITB (NTH EC IT A COMMAND) ) EDITB) ((EDITERR "TOO FEW ELEMENTS"))))) EDITCHAIN))))) ( (SELECTQ COMMAND (| (SETQ EDITCHAIN (LAST EDITCHAIN))) (!0 (OR (CDR EDITCHAIN) (EDITERR "YOU'RE AT THE TOP")) (PROG NIL LOOP (SETQ EOITCHAIN (CDR EDITCHAIN) ) (AND (TAILP (CAR EDITCHAIN) (CADR EDITCHAIN)) (GO LOOP)))) (NX (SETQ EDITCHAIN ((LAMBDA (EDITCHAIN) (EDITONE (QUOTE UP)) (SETQ EDITA (CAR EDITCHAIN) ) (OR (EQ EDITA (CAR EDITCHAIN)) (EDITONE (QUOTE !0))) (OR (SETQ EDITB (AND (TAILP EDITA (CAR EDITCHAIN)) (CCR EDIT A))) (EDITERR "YOU'RE AT THE END")) (CONS (CAR (SETQ LASTAIL EDITB)) EDITCHAIN) ) EDITCHAIN))) (BK (SETQ EDITCHAIN ( (LAMBDA (EDITCHAIN) (EDITONE, (QUOTE OP) ) (SETQ EDIT A (CAR EDITCHAIN)) (EDITONE (QUOTE !0)) (AND (EQ (CAR EDITCHAIN) EDITA) '(EDITERR "YOU'RE AT THE BEGINNING")) (SETQ EDITB (CAR EDITCHAIN) ) (PhOG NIL LOOP (AND (EQ (CDR EDITB) EDITA) (RETURN (CONS (CAR (SETQ LASTAIL EDITB) ) (OR EDITCHAIN J)) (SETQ EC 1TB (CDR EDITB)) (EDITERR "EXPRESSION IS LAST EXPRESSION")) (GO LCOP))) EDITCHAIN))) (!NX (SETQ EDITCHAIN ((LAMBDA (EDITCHAIN) (PROG NIL LOOP (COND ((NULL (SETQ EDITCHAIN (CDR EDITCHAIN))) (EDIT ERR "YOU'RE AT THE END") ) . ((NULL (CDR (HEMQ (CAR EDITCHAIN) (CADR EDITCHAIN)))) (GO LOOP) ) ) (EDITONE (QUOTE NX)))) EDITCHAIN))) (F (SETQ EDITA (EDITNEXT T)) (EDITFINDIT)) (DP (PROG NIL (SETQ EDITA (CAE EDITCHAIN)) LOOP (COND ( (NULL (SETQ EDITB (CDR EDITCHAIN))) (EDITERR "NOT A SUBEXPRESSION")) , ((TAII.P EDITA (CAR EDITB) ) (RETURN NIL).) ( (NOT (SETQ EEITC (KEKQ EDIT A (CAR EDITB)))) (EDITERR "NOT A TAIL")) ((OR (EQ EDITC LASTAIL) (NOT (SETQ EDIT D (MEBQ EDITA (CDR ED I T C ) ) ) ) ) ) ((AND (EQ EDITA (CAR LASTAIL) ) (TAILP LASTAIL EDITD) ) (SETQ EDITC LASTAIL)) (T (TERPRI EDITOUT) (PRIN1 EDITA EDITOUT) (PRIH1 (QUOTE " LOCATION UNCERTAIN") EDITOUT))) (COND ( (EQ EDITC (CAR EDITB) ) (SETQ EDITCHAIN EDITB)) (T (SETQ EDITCHAIN (CONS EDITC EDITB)))))) ( (INSERT I) (EDITCOLLECT (QUOTE (AFTER EEFORE FOR »EDITFLAG* ((LAMBDA (EDITCHAIN) (SETQ EDITD EDIT A EDIT E EDITB) (COND ((MEMO EDITE (QUOTE (: * EDITFLAG*)) ) (SETQ EDITE (QUOTE FOR))) ( (EDIT EVAL (QUOTE (*EC1TFLAG* : ) ) ) ) ) (SELECTQ EDITE (AFTER (EDITSMASH (CAR EDITCHAIN) (CA AR EDITCHAIN) (KCONC EDITD (CDAR EDITCHAIN)))) (BEFORE (COND ((NULL (CCP EDITCHAIN)) (EDITSKASH. (CAR EDITCHAIN) (CAR EDITC) (HCONC (CDR EDITD) (C0K3 (CAAR EDITCHAIN) (CDAR EDITCHAIN))))) ( (TAILP (CAR EDITCHAIN) (CADR EDITCHAIN) ) :))) (EDITOSE (QUOTE BK)) • (EDITONE (OUOTE UP)) (EDITSMASH (CAR EDITCHAIN) . (CA A R EEITCHAIN) (SCONC EDITD (CDAR EDITCHAIN) ) ) ) (T (EDITONE (QUOTE UP)) (EDITSMASH (CAR EDITCHAIN) (NCONC ECITD (CAAR EDITCHAIN)) (CDAR EDITCHAIN)) (OR (CDR EDITCHAIN) (EDITONE 0))))) (FOR (EDITS tt AS H (CAR EDITCHAIN) (CAR EDITD) (NCONC (CDR EDITD) (CDAR EDITCHAIN)))) (EDITERR "NOT BEFORE, AFTER, OR FOR"))) EDITCHAIN)) ( (EMBED EM) {(LAMBDA (EDITCHAIN) (EDITEVAL (QUOTE (IN 'EDITFLAG* : ) ) ) (EDITSMASH (CAR EDITCHAIN) (COPY (EDITHEXT T) (QUOTE *) (CAAR EDITCHAIN)) (CDAR EDITCHAIN) ) ) EDITCHAIN) ) ((EXTRACT EX) ((LAMBDA (EDITCHAIN) (EDIT EV AL (QUOTE (FROM *EDITPLAG* : ) ) ) (SETQ EDITD (CAR EDITCHAIN) ) ) EDITCHAIN) ((LAMBDA (EDITCHAIN) (EDIT EV AL (QUOTE ('SDITFLAG* :))) (OR (FIND (CAR EDITD) (CAR EDITCHAIN) ) (EDITERR "NOT A SUBEXPRESSION")) ("EDITSMASH (CAR EDITCHAIN) (CAR EDITD) (CCAK EDITCHAIN) ) ) EDITCHAIN)) ( (DELETE D) ((LAMBDA (EDITCHAIN) (EDIT EVAL (QUOTE (*EDITFLAG* :))) (COND ((NULL C»ER EDITCHAIN)) (EDITSMASH (CAR EDITCHAIN) (CADAR EDITCHAIN) (CDDAR EDITCHAIN))) ( (TAILP (CAR EDITCHAIN) (CACR EDITCHAIN) ) (EDITONE (QUOTE BK)) (EDITONE (QUOTE UP) ) (EDITSMASH (CAR EDITCHAIN) (CAAR EDITCHAIN) (CDDAR EDITCHAIN))) (T (EDITSMASH (CAR EDITCHAIN) (CADAR EEITC H A IN) (CDDAR EDITCHAIN))))) EDITCHAIN)) (MR ((LAMBDA (EDITCHAIN) (SETQ EDITD (EDITNEXT A)) (EDIT EVAL (QOOTE (*EDITFLAG» : ) ) ) (OR (LISTP (CAAR EDIT CHAIN)) (EDITERR "NOT A SUBEXPRESSION")) (OR (NUMBERP EDITD) (EDITERR "FIRST ARGUMENT MUST BE A.NUMBER")) (SETQ EDITA (CAR EDITCHAIN)) (COND ((ZEKOP EDITD) NIL) ((MINUSP EDITD) (EDITONE 1) (EDITONE (SUB1 EDITD)) (EDITONE (QUOTE UP) ) (EDITSMASH EDITA (CAR EDITA) (CDAR EDITCHAIN) (CAR EDITCHAIN) (CAAR EDITCHAIN) NIL (SETQ EDITB (LAST (CAR EDITCHAIN))) (CAR EDITB) (CCR EDIT A) ) ) (T (EDITONE (ADD 1 EDITD) ) (EDITONE (OUOTE UP) ) (EDITSMASH EDITA (CAR EPITA) (CDAR EDITCHAIN) (CAR EDIT CHAIN) (CAAR EDITCHAIN) NIL (SETQ EDITB (LAST (CAR EDITA))) (CAR EDITB) (CDR EDITA) ) ) ) ) EDITCHAIN) ) (ML ((LAMBDA (EDITCHAIN) (SETQ EDITD (EDITNEXT A)) (EDITEVAL (QUOTE (* EDIT FLAG* : ) ) ) (OR (LISTP (CAAR EDITCHAIN) ) (EDITERR "NOT A SUBEXPRESSION")) (OR (NUMBER? EDIT D) (EDITERR "FIRST ARGUMENT MUST EE A NUMBER")) (COND ({SETQ ECITE (TAILP (CAR EDITCHAIN) (CADR EDITCHAIN))) (EDITONE (QUOTE BK) ) (ELITOHE (QUOTE UP)))) (SETQ EDITA (CAR EDITCHf. Ill) ) (COND ((ZEROP EDITD) NIL) ( (L'Q EDITD -1) (EDITSMASH EDITA (CONS (CA H EDITA) (CADR EDITA) ) (CCDR EDITA))) ( (MINUSP EDITD) (REPEAT (QUOTE (EDITONE (QUOTE BK))) (SUB - 1 EDITD) ) (EDITONE (QUOTE UP) ) (EDITSMASH EDITA (CAR EDITA) (CADR EDITA) (CAR EDITCHAIN) (CONS (CAAR EDITCHAIN) (CDAR EC IT CHAIN) ) (CDDR EDITA))) (ED1TE (EDITONE 2) (EDITONE (ADD1 EDITD)) (EDITONE (QUOTE UP) ) (EDITSMASH EOITA (CAII EDIT A J (CADR EDITA) (CAR EDITCHAIN) (CONS (CA A R EDITCHAIN) (CEAR EDITCHAIN) ) (CDDH EDITA) ) ) ( (EQ EDITD 1) (EDITONE 1) (EDITSMASH EDITA (CAAB EDITCHAIN) (CONS (CDAR EDITCHAIN) (CDR EDITA)))) (T (EDITONE 1) (EDITCNE ECITC) (EDITONE (QUOTE UP) ) (EDITS ASH EDITA (CAAR EDITA) (CDAR EDITA) (CAR EDITCHAIN) (CAAR EDITCHAIN) (CONS (CDAR EDITCHAIN) (CDR ED I T A ) ) ) ) ) ) EDITCHAIN) ) (BO • ' ((LAMBDA (EDITCHAIN) (EDIT EV AL (QUOTE (*EDITFLAG* : ) ) ) (OR (LISTP (CAAR EDITCHAIN)) (EDITERR "NOT A SUBEXPRESSION")) (COND ( (CDAAR EDITCHAIN) (ECITSMASH (CAR EDITCHAIN) (CAAAR EDITCHAIN) (CCAAR EDITCHAIN) (SETQ EDITB (LAST (CAAR EDITCHAIN))) (CAR EDITB) (CDAR EDITCHAIN))) ((ECITSMASH (CAR EDITCHAIN) (CAAAR EDITCHAIN) (CDAR EDITCHAIN))))) EDITCHAIN)) ( B l ((LAHBDA (EDITCHAIN) (ECITEVAL (QUOTE (THRU *EDITFLAG* : ) ) ) (SETQ EDITD (CAR EDITCHAIN) ) ) EDITCHAIN) ((LAMBDA (EDITCHAIN) (ECITEVAL (QUOTE (»EDITFLAG* : ) ) ) (OR (TAILP (CAR EDITCHAIN) EDITD) (EDITERR "NOT OF THE SAME LIST")) (COND ((EQ EDITD (CAR EDITCHAIN) ) (EDITSMASH EDITD (CONS (CAR EDITD) NIL) (CDR EDITD) ) ) ((ECITSMASH EDITD (CONS (CAS EDIT D) (CCR EDITC) ) (CDAR EDITCHAIN) (CAR EDITCHAIN) (CAAR EDITCHAIN) N I L ) ) ) ) EDITCHAIN)) (UNDO (SETQ EDITA (EDITNEXT A)) (OR EDITUKDOLIST (EDITERR "NOTHING SAVED") J (COHD ((EQ EDITS (QOOTE *EDITFLAG*) ) (PROG NIL (SETQ EDITB EDITU M DOLIST) LOOP (COND ( (NULL EDITB) (EDITERR "UNDO WHAT?")) . ((EQ (CAAR EDITB) (QUOTE BLOCK)) (EDITERR "UNDO BLOCKED")) ((MEMO. (CAAR EDITB) (QUOTE (UNDO !UNDO NIL))) (SETQ IDITB (CDR EDITB)) (GO LOOP)) (T (EDITUNDOP (CAAR EDITB)) (EDITUNDO EDITB (QUOTE UNDO)))))) (T (PROG NIL (SETQ EDITC EDITD N DOLIST) LOOP (COND ( (NULL EDITC) (EDITERR "THERE ISN'T OHE")) ( (EQ (CAAR EDITC) EDITA) (EDITUNDOP (CAAR EDITC)) (EDITUNDO EDITC (QUOTE UNDO))) (T (SETQ EDITC (CDR EDITC)) (GO LOOP))))))) (!ONDO (03 (SETQ EDITB NIL EDITA EDITUNDOLIST) (EDITERR "NOTHING SAVEC")) (PROG NIL LOOP (COND ( (OR (NULL EDITA) (EQ (CAAR EDITA) (QUOTE BLOCK))) (EDITUNDO (CONS (CONS (QUOTE UNDO) EDITB) NIL) (QUOTE !UHDO) ) ) ( (NOT (CAR EDITA) ) (SETQ EDITA (CDR EDITA)) (GO LOOP) ) (T (EDITUNDOP (CAAS EDITA) ) (SETQ EDITD (NCONC EDITB (CDAR EDITA) ) ) (RPLACA EDITA NIL) (SETQ EDITA (CDR EDITA) ) (GO LOOP))))) ("-P" (OR EDITUNPRINT (EDITERR "NOW HERE TO GO")) (SETQ EDITCHAIN EDITUNPRINT)) (S (PUT (EDITNEXT T) (QUOTE *EEITFLAG«) (COP* (CAR EDITCHAIN) ) ) ) ( (P "?") (SETQ EDITUNPRINT .EDITSEMUNPRINT EDITNSWUMPR INT EDITCHAIN DOTFLAG (TAILP (CAR EDITCHAIN) (CA CR EDITCHAIN))) (COND ((EQ COMMAND (QUOTE "?")) (PRINTLEV (CAR EDITCHAIN) 1000)) ( (NUMBER? (SETC EDITA (EDITNEXT A))) (PRINTLEV (CAR EDITCKAIN) EDITA)) ((PRINTLEV (CAR EDITCHAIN) 2) (EDITONE EDITA)))) (PP (SETQ EDITUNPRINT EDITNEWUNPRINT EDITNEWUNPRINT EDITCHAIN) (SPRINT (CAR EDITCHAIN) (COND ( (EQ (CAAR EDITCHAIN) (QUOTE PROG) ) 10) (T 1) ) NIL) (TERPRI PRETTTBUFFER) ) (E (PRIST (EVAL (EDIT NEXT T ) ) ) ) (OK (EDITONE (QUOTE TEST) ) (PUT EDITELE (QUOTE *EDITFLAG*) ED ITU N DOLIST) (UNEVAL (QUOTE ED ITST ART) (QUOTE (QUOTE NIL)))) ' (TEST (SETQ EDITUNDOLIST (CONS (CONS (QUOTE BLOCK) NIL) EDITUNDOLIST))) (UNBLOCK (HAP (QUOTE (LAMBDA (EDITELE) (COND ((EQ (CAAR EDITELE) (QUOTE BLOCK)) (DEFPROP EDITFIND EXPR (LAMBDA (EDITB) (COND ((EQUAL EDITA EDITB) ((ATOH EDITB) NIL) ((AND (ATOM EDITA) (EQ (CONS EDITE NIL)) ((PROG (RPLACA EDITELE NIL) (UNEVAL (CUOTE MAP) N I L ) ) ) ) ) EDITUNDOLIST)) ("??" (TERPRI EDITOUT) (MAPC (QUOTE (LAMBDA (EDITELE) (COND (EDITELE (PPIN1 (PRIN1 EDITUNDOLIST) (TERPRI EDITOUT)) (HELP (MTS (QUOTE "COPY CS:MINIEC.HELP"))j (PROGN (PRIN1 COMMAND EDITOUT) (PRIK1 (QUOTE " WHAT?") EDITOUT) (TERPRI EDITOUT) (EDITERR N I L ) ) ) ) ) ) ) ) (CAR EDITELE) EDITOUT) (QUOTE " ") EDITOUT))))) (CONS EDITB NIL) ) EDIT A (CAR EDITB))) (EDITD) (SETQ EDITB EDITB) LOOP (COND ((NULL (SETQ EDITLASTAIL EDITB) ) (RETURN NIL)) ((SETQ EDITC (EDITFIND (CAR EDITB))) (RETURN (NCONC EDITC (CONS (T (SETQ EDITB (CDR EDITB) ) EDITD NIL)))) (GO L O O P ) ) ) ) ) ) ) ) NIL) (DEFPROP EDITCOLLECT EXPR (LAMBDA (EDITSTOPPER) (PROG NIL (SETQ EDITA LOOP (COHD ( (NOT (MEMQ (SETQ EDITB (SETQ EDITA (NCONC EDITA (CONS (COND ( (AND (GET (QUO (EDITB) ) NIL))) (EDITNEXT A)) EDITSTOPPER)) (EQ EDITB (QUOTE f t)) (MEMQ COMMAND (QUOTE (I INSERT)))) (EDITNEXT T) (QUOTE 'ECITFLAG*) (EDITERR "NOTHING.SAVED")))) (DEFPROP EDITERR (GO LOOP)) ((RETURN EDITA)))))) EXPR 81 3 (NLAMBDA (EDITMES) (SETQ EDITLASTCOMMAND (OUOTE P) ) • • (OR (NULL EDITMES) (PRINT EDITMES EDITOUT)) (EDITCOLLECT (QUOTE (*EDITFLAG*))) (UNEVAL (QUOTE EDITTOP) NIL))) (DEFPROP PRINTLEV EXPS (LAMBDA (EDITX EDITN) (TERPRI PRETTYBUFFER) (PRINLEV EDITX EDITN) (TERPRI PRETTYBUFFER))) (DEFPROP KEMCDR EXPR (LAMBDA (EDITC EDITD) (PROG NtL LOOP (COND ((EQ EDITC (CDR EDITD)) (RETURN T) ) { (EQ EDITC EDITD) (RETURN NIL))) (SETQ EDITC (CDR EDITC)) (GO LOOP)))) (DEFPROP TAILP EXPR (LAMBDA (EDITX EDITY) (AND EDITX (PROG NIL LOOP (COND ((ATOM EDITY) (RETURN NIL)) ((EQ EDITX EDITY) (RETURN EDITX))) (SETQ EDITY (CDR EDITY)) (GO LOOP))))) (DEFPROP PRINLEV EXPR (LAMBDA (EDITX EDITN) (COND ( (ATOM EDITX) (PRIN1 EDITX PRETTYBUFFER)) ((ZEROP EDITN) (PRIN1 EDITAMP PRETTYBUFFER)) (T (PROG (EDITA EDITB) (PRItM (COND (DOTFLAG (SETQ DOTFLAG NIL) EDITDOTS) (T PRETTYLP) ) PRETTYBUFFER) (PRINLEV (CAR EDITX) (SUB1 EDITN) ) (SETQ EDITA EDITX) LOOP (COND ((MEMCDR EDITX EDITA) (COND (EDITC (PRIN1 EDITDOT* PRETTYBUFFER) (RETURN NIL)) (T (SETQ EDITB T) ) ) ) ) (SETQ EDITA (CDR EDIT A)) (COND ( (NULL EDITA) (PRIH1 PRETTY RP PRETTYBUFFER) (RETURN NIL)) ( (ATOM EDITA) (PRIN1 EDITDOT PRETTYBUFPER) (PRIM1 EDITA PRETTYBUFFER) (PRIN1 PHETTYRP PR5TTY BUFFER) (RETURN . NIL) ) ) (PRIH1 PRETTYBL PR ETTY BUFFER) (COND ( (LISTP (CAR EDITA) ) (PRINLEV (CAS EDITA) (SUE1 EDITS))) (T (PRIN1 (CAR EDITA) PRETTYBUFFER))) (GO LOOP)))))) (DEFPROP EDITFINDIT EXPR (LAMBDA NIL (SETQ EDITB (CAB EDITCHAIN)) (COHD ((SETQ EDITLASTAIL LASTAIL EDITF (EDITFIND EDITB)) (SETQ LASTAIL EDITLASTAIL EDITCHAIN (NCONC EDIT? (CDR EDITCHAIN))) (AND (ATOM (CAR EDITCHAIN)) (EDITONE (QUOTE DP")))) (T (TERPRI EDITOUT) ( T RIK1 EDITA EDITOUT) (PRIN1 (QUOTE •• *OT FOUND") EDITOUT) (TERPRI EDITOUT) (EDITERR N I L ) ) ) ) ) (DEFPROP EDITEVAL EXPR (LAMBDA (EDITTEST) (EDITCOLLECT EDITTEST) (MAPC (QUOTE (LAMBDA (EDITA) (COND ((OR (NUMBERP EDITA) (MEMQ EDITA ED1TCOKM AN DS) ) (EDITONE EDITA)) ( (EDITFINDIT) ) ) ) ) EDITA) (OR (NOT (CDR EDITCHAIN)) (TAILP (CAR EDITCHAIN) (CADR EDITCHAIN) ) (EDITONE (QUOTE UP))))) (DEFPROP EDITUNDO EXPR (LAMBDA (EDITLIST EDITTYPE) (PROG (EDITA) (SETQ EDITUNDOLIST (COSS (CONS EPITTYPE (REVERSE (CDAR EDITLIST))) EDITUNDOLIST)) (SETQ EDITA (CDAR EDITLIST) ) LOOP (OR EDITA (RETURN (KPLACA EDITLIST NIL))) (SETQ EDITE (CAAAR EDITA) EDITF (CDAAR EDITA) ) (RPLACA (CAAR EDITA) (CADAR EDITA) ) (RPLACD (CAAR EDITA) (CDDAR EDITA)) (RPLACA (CDAR EDITA) EDITE) (RPLACD (CDAR EDITA) EDITF) (SETQ EDITA (CDR EDITA)) (GO LOOP) ) ) ) (DF.FPRDP EDITTOP EXPR (LAMBDA (EDITLIST) (EDITONE EDITLIST))) (DEFPROP EDITUNDOP EXPR (LAMBDA (EDITELE) (TERPRI EDITOUT) (PRIN 1 EDITELE EDITOUT) (PRIN1 (QUOTE " UNDONE") EDITOUT) (TERPRI EDITOUT))) (DEFPROP EDITE EXPR (LAMBDA (EDITLIST) (OPEN (EDITIN 100 *SOURCE*) (EDITOUT 70 *SIHK») (PRETTYBUFFER 80 *SINK*)) (STATUS (11 EDITIN EDITINTERCEPT) (5 EDITOUT T) (13 EDITIN ".") (13 EDITOUT :) (13 PRETTYBUFFER :)) (SETQ EDITELE (QUOTE EDITUNDOLIST)) (REM (QUOTE EDITUNDOLIST) (QUOTE *ECITFLAG*.) ) (EDITSTART EDITLIST))) (DEFPROP EDITEXCISE EXPR (LAMBDA NIL (REM (QUOTE 83 (EDITF EDITNEXT EDITINTERCEPT EDITSMASH EDITSTART EDITONE EDITFIND EDITCOLLECT EDITERR PRINTLEV MEMCDR TAILP PRINLEV EDITFINDIT EDITEVAL ED1TUNDO EDITTOP EDITUNDOP EDITE EDITEXCISE)) (QUOTE EXPR)))) (SETQ EDITCOMMANDS (QUOTE (NX OK P PP TEST UNBLOCK UNDO UP NX UNDO 0 " ? " •'??" " - P " ) ) ) •"EDITOR LOADED") (PROGN (DEFPROP PRETTTSETUP EXPS (NLAMBDA (PRETTY BUFFER NAME) (SETQ PRETTYBL (COPY (QUOTE " ") ) PRETTYLP (COPY (QUOTE " (") ) PRETTYKP (COPY (QUOTE " ) " ) ) ) (OPEN (PRETTYTHY 60)) (STATUS (12 PRETTYTRY PRETTY BB) (5 PRETTYTRY T) (6 PRETTYTRY T)) (APPLY 1 (QUOTE STATUS) (LIST 0 PRETTYBUFFERNAME T) (LIST 6 PRETTYBUFFERNAME T ) ) ) ) (DEFPROP PRETTYPRINT EXPR (FLAMBDA (PRETTYLIST) (PROG (PRETTYC PRETTY B PRETTY R P PRETTYLP PRETTYBL) (OPEN (PRETTYBUFFER 100)) (SETQ PRETTYB 80) (PRETTYSET.UP PRETTYBUFFER) (MAPC (QUOTE (LAMBDA (PKETTYELE) (TERPRI PRETTYBUFFER) (S PRINT (GET PRETTYELE (QUOTE EXPR) (QUOTE (PROGN (TEKPHI) (PRIN1 PRETTYELE) (PRIN1 (QUOTE " NOT FOUND")) (TERPRI) ) ) ) 1 NIL))) PRETTYLIST) (TERPRI PRETTYBUFFER) ) ) ) (DEFPROP DSKOUT EXPR (FLAHBDA (FILE) (PROG (PRETTYC FRETTYDEF PRETTVRP PR ETTYLP PRETTYBL PR ETTYO) (AND (GET (QUOTE UNBREAK) (QUOTE EXPR) ) (UNEREAK) ) (SETQ PRETTYDEF (COPY (QUOTE " (DEFPROP " ) ) ) (APPLY 1 (QUOTE OPEN) (LIST (QUOTE PRETTY BUFFER) (ADD (SETQ PRETTY B 100) 20) (CAR FILE))) (PRETTYSETUP PRETTYBUFFER) (MA PC (QUOTE PRETTY DSK) (CDR FILE)) (QUOTE DONE) ) ) ) (DEFPROP PRETTYLEN EXPR (LAMBDA (PRETTYA) (PLEN PRETTYA))) (DEFPROP SPRINT EXPR (LAHBDA (PRETTYFII PRETTYINDENT PRETTY PROGFLAG) (COND ( (ATOM PRETTYFN) (COND ((EQ PRETTIPROGFLAG (QUOTE PROG)) (TERPRI PRETTYBUFFER) (TAB (SUB PRETTYINDENT (PRETTYLEN PRETTYFN) 1) PRETTYBUFFER) (PRItll PRETTYFN PRETTYBUFFER) (SETQ PRETTYC T) ) (T (TAB PRETTYINDENT PRETTYBUFFER) (PRIN1 PRETTYFN PRETTYBUFFER)))) ( (MEMQ (CAR PRETTYFN) (QUOTE (COND PROG LAMBDA SELECT FLAMBDA NLAMEDA) ) ) (SPRINTIT)) ( (GR EATERP (SUB PR ETTYB (PRETTYLEN (TAB PRETTYINDENT PRETTYBUFFER))) (PRETTYBLEN PRETTYFN) ) (PRIN1 PRETTYFN PRETTYBUFFER)) ((SPRINTIT))))) (DEFPROP SPRINTIT EXPR (LAMBDA NIL (TAB PR ETTYINDENT PRETTYBUFFER) (P8IR1 PRETTYLP PRETTYBUFFER) (COND ((ATOM (CAR PRETTYFN)) (PRIN1 (CAR PRETTYFN) PRETTYBUFFER) (-PRIN1 PRETTYBL PRETTYBUFFER) (COND ((GREATERP PRETTY B (ADD (PRETTYBLEN (CADR PRETTYFN)) (PRETTYLEN (SKIP 0 PRETTYBUFFER)))) (SETQ PRETTY INDENT (ADD (PRETTYLEN (SKIP 0 PRETTYBUFFER)) 1)) (PHIN1 (CADR PRETTYFN) PRETTYEUFF ER) (MAPC (QUOTE (LAMBDA (PRETTYFNQ) (COND (PRETTYC (SETO PRETTYC NIL) ) ((TERPRI PRETTYBUFFER))) (SPRINT PRETTYFNQ PRETTYINDENT (CAR PRETTYFN)))) (CLDR PRETTYFN))) (T (MAPC (QUOTE (LAMBDA (PRETTY FN Q) (CONE (FRETTYC (SETQ PRETTYC NIL)) { (TERPRI PRETTYBUFFER))) (SPRINT PRETTYFNQ (ADD PRETTYINEENT 2) (CAR PR ETTY FN)))) (CDR PRETTYFN) ) ) ) ) (T (SPRINT (CAR PRETTYFN) (ADD1 PRETTYINDEKT) NIL) (MAPC (QUOTE (LAMBDA (PRETTYFNQ) (TERPRI PRETTYBUFFER) (SPRINT PRETTYFNQ (ADD1 PRETTYINDENT) NIL))) (CDR PRETTYFN)))) (PRIN1 PRETTYRP PRETTYBUFFER))) -(DEFPROP PRETTYBLEN EXPR (LAMBDA (PRETTYX) (TAB 1 PRETTYTRY) (PBIN1 PRETTYX PRETTYTRY) (PRETTYLEN (SKIP 0 PRETTYTRY)))) (DEFPROP PRETTYBB EXPR (LAMBDA (X) (UNEVAL (QUOTE PRETTYBLEN) (QUOTE 1000)))) • (DEFPROP DSKIN EXPR (FLAMBDA (FILE) (PBOG (FUNCTIOK'S IN) (MAPC (QUOTE (LAMBDA (FILE) (SETQ FUNCTIONS NIL) (APPLY 1 (QUOTE OPEN) (LIST (QUOTE PRETTYBUFFER) 255 FILE)) (STATUS (16 PRETTYBUFFER PRETTYEOF)) (REPEAT (QUOTE (COND ( (EQ (CAR (SETQ- IN (READ PRETTYBUFFER) ) ) (QUOTE . CEFUN) ) (SETQ FUNCTIONS (CONS (EVAL IN) FUNCTIONS))) ((EQ (CAR IN) (QUOTE DEFPROP)) (SETQ FUNCTIONS (CONS (EVAL IN) FUNCTIONS))) ((EQ (CAR IN) (QUOTE DEFINE)) (SETQ FUNCTIONS (COND ( (ATOM (SETQ IN (EVAL IN))) (CONS IN FUNCTIONS) ) (T (HCON'C III FUNCTIONS))))) (T (SETQ FUNCTIONS (CONS IN FUNCTIONS)) (EVAL IN ) ) ) ) 10000))) FILE) (QUOTE DONE) ) ) ) (DEFPROP PKETTYDSK EXPR (LAMBDA (PRETTYELE) (COND ( (ATOM PRETTYELE) (TERPRI PRETTYBUFFER) (PR1N1 PRETTYDEF PRETTYBUFFER) (PRIH1 PRETTYELE PRETTYBUFFER) (PRIN1 PRETTYBL PRETTYBUFFER) (PRIK1 (CAR (SETQ PRETTYQ (GETL PRETTYELE (QUOTE (EXPR MACRO BUG) ) (QUOTE • • (PROGN (TERPRI) (PRIN1 (QUOTE "NOT A FUNCTION")) (PRINT (QUOTE "ENTER FUNCTION NAME OR N i t " ) ) (COND ((NULL (SETQ PRETTYQ (READ))) (UNEVAL (QUOTE PRETTYDSK) NIL)} (T (UNEVAL (QUOTE PRETTYDSK) (QUOTE (PRETTYDSK PRETTYQ)))))))))) PRETTYBUFFER) (TERPRI PRETTYBUFFER) (SPRINT (CADR PRETTYQ) 3 NIL) (PR IN 1 PRETTYRP PRETTYBUFFER) (TERPRI PRETTYBUFFER)) (T (SPRINT PRETTYELE 1 NIL) (TERPRI PRETTYBUFFER))))) (DEFPROP PRETTYEOF EXPR (LAMBDA (FI) (PUT FILE (QUOTE FUNCTIONS) (REVERSE FUNCTIONS)) (UNEVAL (QUOTE REPEAT) NIL))) (DEFPROP UPDATE EXPR (FLAMBDA (FILE) (PROG (PRETTYC PRETTYDEF PRETTYRP PRETTYLP PRETTYBL PRETTYQ) (AND (GET (QUOTE UNBREAK) (QUOTE EXPR) ) (UNBREAK) ) (SETQ PRETTYDEF (COPY (QUOTE "(DEFPROP " ) ) ) (OPEN (PRETTYBUFFER 120 -LISPTEMP)) (MTS (QUOTE "EMPTY -LISPTEMP")) (PRETTYSETUP PRETTYBUFFER) (SETQ PRETTYB 100) (MAPC (QUOTE PRETTYDSK) (GET (CAR FILE) (QUOTE FUNCTIONS) (QUOTE (PROGN (TERPRI) (PRIN1 (QUOTE "NO FUNCTIONS FOR")) (PRIN1 (CAR F I L E ) ) ' (RETURN (TERPRI)))))) (MAPC (QUOTE PRETTYDSK) (CDR FILE)) (STATUS (6 PRETTYBUFFER NIL) ) (TAB 1 PRETTYBUFFER) (PRIN1 (QUOTE "EMPTY ") PRETTYBUFFER) (PRIN1 (CAR FILE) PRETTYBUFFER) (MTS (CAR PRETTYBUFFER)) (TAB 1 PRETTYBUFFER) (PRIN1 (QUOTE "COPY -LISPTEMP TO ") PRETTY BUFFER) (PRIN1 (CAR FILE) PRETTY BUFFER) (MTS (CAR PRETTYBUFFER)) (STATUS (6 PRETTYBUFFER T) ) (QUOTE DONE) ) ) ) •"DSKIO LOADED") 87 INDEX I ...6,40 II 40 -<P 26 !NX 9 •UNDO .23 !0 7 -H 3 ? ......25 ?? 21 f t ....27 ARGS 40 AT 42 B l . .. ........18 BK 8,43 BKE 43 BKF 43 BO 19 BREAKCMDS ....38 BREAKEXPR 38 BREAKF 37,44 BREAKFN 38 BREAKFUNCTION .......37,38 BREAKPOINTER ..........41 BREAKTYPE .....38 BREAKWHEN 38 BREAKO 46 CS:BREAK , .......59 CSrDSKIO .....61 CS:MINIED 34 D 13 DELETE 13 DSKIN 60 DSKOUT 60 E 27 EDIT 42 EDITCHAIN ...3 EDITE 2,34 EDITEXCISE 34 EDITF ....2,34 EM 14 EMBED .14 E r r o r Package 37 ERRORPACKAGE ..47 EVAL 39 EX i .........15 EXTRACT 15 F 10,41 FROM 39,42 GO 39 HELP 27,40 I .......12 INSERT .............12 L o c a t i o n S p e c i f i c a t i o n .......11 ML 17 MR 17 88 n 3 NX 8 OK 27,39 P 25 PP .....25 PRETTYPRINT 60 RETURN .....39 S ....27 TEST 24 TOP 42 TRACE 37,44 UNBLOCK 24 UNBREAK .....44 UNDO .11,22 UNTRACE 45 UP 5 UPDATE 61 USE ...39 0 3 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            data-media="{[{embed.selectedMedia}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
https://iiif.library.ubc.ca/presentation/dsp.831.1-0052013/manifest

Comment

Related Items