4/19/72 - JONL - LISP WILL NOW CHECK THE NUMBER OR ARGUMENTS GIVEN TO A SYSTEM SUBR, AND GENERATE A [CORRECTABLE] ERROR IF THE WRONG NUMBER ARE GIVEN. THERE IS A NEW FUNCTION, "ARGS", OF TWO ARGUMENTS IMPLEMENTED TO OBTAIN THE NUMBER OF ARGS FOR A GIVEN SUBR, AND TO SET THIS PARAMETER CURRENTLY, THIS FEATURE IS IMPLEMENTED USING AN "ARGS" PROPERTY ON THESE ATOMS. THE CORRECTABLE ERRORS ARE UTILIZED BY MEANS OF THE USER INTERRUPT FEATURE - IF THE INTERUPT NUMBER CORRESPONDING TO THE ERROR HAS AN ASSOCIATED FUNCTION, AND IF THE ERROR IS NOT CAUGHT UNDER ERRSET, THEN THAT FUNCTION WILL BE APPLIED TO AN APPROPRIATE ARGUMENT, AND THE RESULT, IF NON-NIL, WILL BE TAKEN TO BE A LIST OF A CORRECTED FORM. THE BASIC GOAL OF AN ERROR RECOVERY INTERRUPT IS TO DETECT A FAULTY FORM NOT OTHERWISE CAUGHT [AS BE ERRSET], AND TO ALLOW THE USER TO SUBSTITUTE A CORRECTED FORM FOR THE FAULTY ONE; IF THE SERVICE IS ASSUMED THAT NO CORRECTION IS DESIRABLE, AND AN ORDINARY LISP ERROR IS CREATED, WITH CONSEQUENT RETURN TO TOP LEVEL. INITIALLY, THESE INTERRUPTS COME SET TO A SIMPLE INTERNAL FUNCTION, WITH ARGUMENT "ARGS", THAT SIMPLY ENTERS A BREAK LOOP. [A BREAK LOOP HAS AN EXPLICIT ERRSET AROUND IT, SO THAT ERRORS AT THIS LEVEL WILL BE RETURNED TO THE LOOP, RATHER THAN ENTER THE RECOVERY SYSTEM RECURSIVELY. HOWEVER THE USER MAY RESET THE INTERRUPT FUNCTION TO ONE THAT DOES NOT DO AN ERRSET, AND THUS EXPECT RECURSIVE HANDLING OF ERRORS.] INTERRUPT # MEANING 5 UNDEFINDED FUNCTION - USER CAN GIVE ANOTHER FUNCTION TO BE USED IN PLACE OF LOSER, OR DEFUN THE LOSER AND GIVE IT BACK TO BE TRIED AGAIN. 6 UNBOUND VARIABLE - USER CAN GIVE BACK ANY FORM TO BE EVAL'D IN PLACE OF THE VALUELESS VARIABLE. 7 WRONG TYPE OF ARGUMENT - AS FOR UNBOUND VARIABLE, CAN GIVE OUT ANY FORM TO BE EVAL'D AND TAKE THE PLACE OF THE LOSING ARGUMENT 8. UNSEEN GO TAG - CAN GIVE AN ATOM TO TRY AS THE RIGHT GO TAG. 9. WRONG NUMBER OF ARGUMENTS TO SOME FUNCTION - THE EVALUATION OF SOME FORM WILL HAVE TO BE RESTARTED: SEE EXAMPLE IMMEDIATELY BELOW. 10. GC LOSSAGE [FAILED TO COLLECT ENOUGH SPACE] - AS DESCRIBED IN PRIOR NOTES, THIS FUNCTION WILL GET AS ARGUMENT EITHER "LIST" "FIXNUM" OR "FLONUM" DEPENDING ON WHICH SPACE OVERFLOWED. IF THE RETURNED VALUE IS NON-NIL, ANOTHER GC WILL BE INITIATED AND HOPEFULLY SOME SPACE WILL HAVE APPEARED. WHILE IN A BREAK LOOP OF ONE THESE INTERRUPT FUNCTIONS, THE USER COULD OF COURSE FIND THE CONTEXT IN WHICH THE OFFENDING FORM OCCURS, AND EDIT IT TO SOME CORRECT STATE. HE IS STILL OBLIGED, HOWEVER, TO GIVE OUT AS VALUE SOME S-EXPRESSION THAT WILL DO IN PLACE OF THE LOSER JUST CAUGHT. FOR EXAMPLE, IF A USER TRIES TO EVAL (CONS X), THE FUNCTION FOR WRONG NUMBER OF ARGUMENTS [INTERRUPT FUNCTION NUMBER 9.], WILL BE HANDED A TWO-LIST INDICATING THE FUNCTION ABOUT TO BE APPLIED AND THE ARGUMENTS ACTUALLY PASSED ALONG, AND A NUMBER INDICATING THE CORRECT NUMBER OF ARGUMENTS FOR THE FUNCTION. [IF CONS WERE AN EXPR, THE SECOND ARGUMENT WOULD BE THE LAMBDA LIST.] IN THIS EXAMPLE, ARG = ((CONS (A B C)) 2), WHICH SHOWS THAT CONS WAS BEING CALLED AND THE VALUE [REPEAT! VALUE] OF THE ARGUMENT TO CONS WAS (A B C); THE USER, AFTER INSPECTING ARGS, MIGHT TYPE (RETURN '( (CONS '5 '(A B C)) )) REMEMBERING THAT BREAK, UPON READING A RETURN, WILL ITSELF RETURN THAT VALUE, WHICH IS EITHER NIL OR A LIST OF THE CORRECTED FORM; IN THIS CASE, THE EVALUATION OF (CONS . . .) WILL BE RESTARTED AND REPLACED BY (CONS '5 '(A B C)). ALSO, ONE MIGHT WANT TO HAVE *RSET = T WHILE DEBUGGING, SO THAT HE MAY GET MEANINGFUL OUTPUT FROM BACKTRACE. A SAMPLE INTERACTION FOLLOWS, WITH LISP'S OUTPUT PRECEEDED BY * (FOO 'X) ;HOPELESS USER WILL TRY ANYTHING * BKPT UNDF-FNCTN ;LISP GENERATES TIMELY MESSAGE ARGS ;USER WOULD LIKE TO KNOW WHAT FUNCTION IS * FOO ;CAUSING TROUBLE (DEFUN FOO (A B) (PLUS A B)) (RETURN '( FOO )) ;AFTER CORRECTING, HE TRIES FOO AGAIN * BKPT WRNG-#-ARGS ;STILL NOT WINNING ARGS ;OUR HERO IS STILL CURIOUS * ((FOO X) (A B)) ;SO HE WILL LOOK UP THE MEANING OF THIS IN ;.INFO.;LISP ARCHIV, PAGE HEADED 3/17/72 ;IF FOO WERE A SYSTEM SUBR OF TWO ARGUMENTS, ;THIS VALUE WOULD BE ((FOO X) 2) (RETURN '( (FOO 'X 3) )) ;HE THINKS HE SIMPLY FORGOT THE 3 * BKPT WRNG-TYPE-ARG ARGS * X (RETURN '( 2 )) ;THIS IS THE LAST KLUDGY ATTEMPT TO WIN * 5 ;AHA, A WELL-KNOWN RESULT THE WRONG TYPE ARG ERROR IS INTENDED TO CATCH A WIDE VARIETY OF CASES WHEREIN A FUNCTION HAS BEEN HANDED AN UNSUITABLE ARGUMENT ORDINARILY, FOR A WRONG TYPE ARG OR AN UNSEEN GO TAG ERROR, THE OFFENDING S-EXPRESSION IS HANDED TO THE INTERRUPT FUNCTION WHICH MAY RECOVER BY SUBSTITUTING SOME OTHER ONE FOR IT [OR BY CORRECTING, AND REQUESTING TO TRY THE SAME ONE AGAIN]. HOWEVER, FOR AN ARRAY ACCESS ERROR, WHICH OCCURS WHEN THE INDEX TO THE ARRAY IS TOO LARGE OR IS NEGATIVE, THE WRONG TYPE ARG ROUTINE GETS A LIST AS IN THE FOLLOWING EXAMPLE: (ARRAY A T 40) (STORE (A 37) 'RANDOMVALUE) (SETQ N 40) (A N) * BKPT WRNG-TYPE-ARG ARGS * (ARRAYINDEX (A 40)) (RETURN '( (A (1- N)) )) * RANDOMVALUE JONL 04/19/72 GRINDEF, AS FOUND ON COM:E GRIND WILL NO LONGER EXIT BY CALLING ERR, BUT WILL RETURN THE ATOM WITH THE NULL PNAME [(ASCII 0)]. THIS WILL HAVE THE EFFECT NOT ONLY OF SUPPRESSING THAT ANNOYING * AFTER A GRINDEF, BUT ALSO IF GRINDEF IS CALLED FROM INSIDE ANOTHER FUNCTION, THERE WILL BE NO ERR OUT. VERY SHORTLY, IRA'S GRINDER WILL BECOME THE STANDARD, BOTH AS COM:E GRIND, AND AS THE ONE IN SYS:TS INDEX. IT HAS MANY NICE FEATURES. JONL 04/12/72 NEW COMPLR, AND READCH. COMPLR 234 WILL COMPILE THE MULTIPLE-INDEX DO FORMAT RECENTLY DESCRIBED. IT ALSO WILL CONVERT A MAP INTO A DO, WHEN NECESSARY, TO PREVENT MAKING VARIBALES (IN THE LAMBDA-FORM GIVEN TO THE MAP) UNNECESSARILY SPECIAL. READCH NOW RUNS FASTLY, IN LISP 229X; IN GENERAL, IT CAN BE EXPECTED TO RUN AS FAST AS TYI. JONL 04/06/72 HINT: TO PLOT ON THE PLOTTER ALL THE ARRAYS CURRENTLY ON DISPLAY IN THE DISPLAY SLAVE: (DEFUN PLOTALL NIL (PLOTLIST (MAPCAR '(LAMBDA (N) (GET (DISGORGE N) 'ARRAY)) (DISLIST))))