JONL 3/22/73 1) THE CONTROL CHARACTERS ^P AND ^U NO LONGER ARE RELEVANT TO THE INTERPRETIVE PLOTTER: ^P IS NOT USED, AND ^U IS NOW USED FOR THE PAGEPAUSER DESCRIBED BELOW. THE PLOTTER MAY BE CLOSED AND RELEASED BY EXECUTING (PLOT 0), AND ANY OTHER PLOTTER REQUEST WILL SIEZE AND OPEN UP THE PLOTTER OF IT IS NOT ALREADY OPEN. 2) (SSTATUS PAGEPAUSE T) WILL TURN ON AN INTERESTING MODE FOR LISP USERS LOGGED IN FROM DISPLAY CONSOLES. NIL INSTEAD OF T REVERTS TO THE STANDARD MODE. (STATUS PAGEPAUSE) INTERROGATES THE FLAG. (STATUS SYSTEM X) ASSUMES THAT X IS AN ATOM, AND RETURNS A LIST OF PROPERTIES [EXCEPT PNAME] THAT ARE ON THE ATOM AT LISP LOAD TIME. THUS, SINCE "ALARMCLOCK" IS A SYSTEM SUBR, AND ALSO A TOP-LEVEL GLOBAL VARIABLE: (STATUS SYSTEM 'ALARMCLOCK) = (VALUE SUBR) 3) THREE NEW FUNCTIONS. IN THE FOLLOWING, LET X AND Y BE PNAME-TYPE ATOMS, AND N BE A FIXNUM: (ALPHALESSP X Y) RETURNS T IF X PRECEEDS Y IN THE ASCII LEXICAL ORDERING. NIL OTHERWISE. (GETCHAR X N) RETURNS THE NTH CHARACTER OF THE PNAME OF X. (SAMEPNAMEP X Y) RETURNS T IF X AND Y HAVE THE SAME PNAME [IF (SAMEPNAMEP X Y) = T, AND (EQ X Y) = NIL, THEN X AND Y CAN'T BOTH BE ON A GIVEN OBARRAY]. 4) HASH-CODING. TO FACILITATE HASHCODING SCHEMES FOR S-EXPRESSIONS, THE FUNCTION SXHASH HAS BEEN WRITTEN: (SXHASH FOO) WILL PRODUCE A 35.-BIT SIGNED INTEGER FOR ANY S-EXPRESSION FOO, AND ANY TWO EQUAL EXPRESSIONS WILL SXHASH TO THE SAME NUMBER. IT WOULD BE A VERY GOOD IDEA FOR USERS WHO WANT TO WRITE THEIR OWN HASHING FUNCTIONS TO DEFINE THEM IN TERMS OF THE RESULTS FROM SXHASH, AND DEFINITELY NOT IN TERMS OF THE "POINTER" FOR THE S-EXPRESSION. FOR EXAMPLE, TO HAVE A TABLE OF S-EXPRESSIONS ONE COULD WRITE: (DEFUN KNOWNP (X) (PROG (I BKT) (SETQ I (PLUS 76 (REMAINDER (SXHASH X) 77))) ;THE REMAINDER SHOULD BE REASONABLY RANDOMIZED BETWEEN ;-76 AND 76, THUS TABLE SIZE MUST BE > 175 (SETQ BKT (TABLE I)) ;BKT IS THUS A LIST OF ALL THOSE EXPRESSIONS THAT HASH ;INTO THE SAME NUMBER AS DOES X (RETURN (MEMQ X BKT)))) TO WRITE AN "INTERN" FOR SEXPRESSIONS, ONE COULD THUS DO (DEFUN SINTERN (X) (PROG (BKT I TEM) (SETQ BKT (TABLE (SETQ I (+ 2N-2 (\ (SXHASH X) 2N-1))))) ;2N-1 AND 2N-1 STAND FOR A POWER OF 2 MINUS ONE AND ;MINUS TWO RESPECTIVELY. THIS IS A GOOD CHOICE TO ;RANDOMIZE THE RESULT OF THE REMAINDER OPERATION (RETURN (COND ((SETQ TEM (MEMBER X BKT)) (CAR TEM)) (T (STORE (TABLE I) (CONS X BKT)) X))))) SEVERAL INCARNATIONS OF LISP FOLLOW THE "RELOCATING" GARBAGE- COLLECTOR STRATEGY, AND IN THESE LISPS THE ADDRESS, OR "POINTER" FOR A GIVEN S-EXPRESSION WILL CHANGE AFTER A GC. THUS TRYING TO REWRITE KNOWNP AS (DEFUN KNOWNP (X) (PROG (I II) (SETQ II (SETQ I (\ (MAKNUM X) 2N-1))) A (COND ((EQ (TABLE I) X) (RETURN T)) ((< (SETQ I (1+ I)) 2N-1) (GO A))) (SETQ I -1) B (COND ((NOT (< (SETQ I (1+ I)) II)) (RETURN NIL)) ((EQ (TABLE I) X) (RETURN T)) (T (GO B))))) WILL SURELY LEAD TO MUCH GRIEF. 5) IT HAS COME TO MY ATTENTION THAT MANY PERSONS ARE USING THE ERRLIST AS A MEANS FOR REDEFINING THE TOP LEVEL FUNCTION. ONE MUST BE CAREFUL TO PLACE ERRSETS AROUND ANY COMPUTATIONS ON THE ERRLIST THAT MIGHT CONCEIVABLY LEAD TO BOMB-OUT ERRORS, FOR OTHERWISE, THE LISP MAY GET INTO AN INFINITE LOOP OF ERRORS. TO ENCOURAGE THE USE OF THE MACLISP TOPLEVEL FEATURE, THE TOPLEVEL FUNCTION HAS BEEN SLIGHTLY REVISED AS FOLLOWS: (PROG () B (ERRSET (PROG () (SETQ ^R NIL) ;IN ADDITION, MANY OTHER INTERNAL ;VARIABLES ARE RESET TO TOP LEVEL ;SETTINGS, INCLUDING PDL POINTERS, ;FLAGS ETC. (MAPC 'EVAL ERRLIST) (SETQ * '*) A (SETQ * (COND ((STATUS TOPLEVEL) (EVAL (STATUS TOPLEVEL))) (T (PRINT *) ;CYCLING THRU THE LOOP (TERPRI) ;IS ESSENTIALLY PRINT (EVAL (READ))))) ;OF EVAL OF READ (GO A))) (GO B)) ;IF ERROR OCCURS, RESTART AT B INSTEAD OF A 7) SETTING THE VALUE OF THE VARIABLE "SPECIAL" TO NON-NIL IN THE COMPLR WILL CAUSE EVERY VARIABLE TO BE AUTOMATICALLY DECLARED SPECIAL. THIS WILL TAKE THE HEAT OFF THE POOR LOSER WHO TRIES TO COMPILE SOMEONE ELSE'S PROGRAM WITHOUT ACTUALLY UNDERSTANDING THE OTHER'S PROGRAM. HOWEVER, IT SHOULD BE NOTED THAT SOME REPRESENTATIVE, SAMPLE LISP PROGRAMS HAVE BEEN OBSERVED TO REQUIRE 40% MORE RUNNING TIME IF COMPILED FOR ALL VARIABLES BEING SPECIAL THAN IF COMPILED WITH JUDICIOUS USE OF SPECIALIZATION. 8) (TYIPEEK T) HAS BEEN SLIGHTLY EXTENDED SO THAT ANY SPLICING MACRO CHARACTERS OCCURING AT TOP-LEVEL READ WILL BE EXECUTED, AND THEN TYIPEEK SCANNING CONTINUED. THIS IS TO ALLOW MACROS LIKE SEMI-COLON TO DISPOSE OF THEIR COMMENT CHARACTERS, AND IS FAIL-SAFE FOR READ, SINCE READ WOULD ONLY DO THE SAME THING [IE, EXECUTE THE SPLICING MACRO FUNCTION, AND TOSS OUT THE RESULT.]