WEDNESDAY JUNE 11,1975 NM+2D.17H.37M.36S. LISP 1076 - GLS - TRY NEWIO! BRIEF SYNOPSIS: FOR ALL LISPS: [1] PRIN1, PRINC, AND PRINT NOW ALWAYS RETURN T [2] NEW FUNCTION: PROGV DOES DYNAMIC VARIABLE BINDING [3] NEW FUNCTION: MAPATOMS MAPS OVER ALL ATOMS IN AN OBARRAY [4] FLATC HAS BEEN SPEEDED UP FOR SYMBOLS FOR NEWIO: [A] EDIT NOW WORKS [B] NEW FUNCTION: LOAD LOADS UP BOTH EXPR AND FASL FILES [C] NEW FUNCTION: INCLUDE IS LIKE A MIDAS .INSRT [D] UREAD'S EOF HANDLER HAS CHANGED [E] NEW FUNCTION: FILEPOS IS FINALLY IMPLEMENTED [F] (STATUS FILEMODE) RETURNS FILEPOS INDICATOR IF APPROPRIATE ---------------------------------------------------------------- [1] PRIN1, PRINC, AND PRINT NOW ALL RETURN T INSTEAD OF THEIR ARGUMENTS. THIS IS A BELATED FAST ARITHMETIC MOD. [2] (PROGV <VAR-LIST> <VALUE-LIST> <FORM1> <FORM2> ... <FORMN>) EVALUATES <FORM1> ... <FORMN> AS A PROGN IN AN ENVIRONMENT CREATED BY BINDING THE SYMBOLS IN <VAR-LIST> TO THE RESPECTIVE VALUES IN <VALUE-LIST>. THAT IS, THE FIRST TWO ARGUMENTS TO PROGV ARE EVALUATED; THE FIRST MUST PRODUCE A LIST OF SPECIAL VARIABLES, AND THE SECOND A LIST OF VALUES. THE VARIABLES ARE THEN BOUND TO THE VALUES. IF TOO FEW VALUES ARE SUPPLIED, THE REST OF THE VARIABLES ARE BOUND TO NIL. IF TOO MANY VALUES ARE SUPPLIED, THE EXCESS VALUES ARE IGNORED. THE BODY OF THE PROGV IS THEN EVALUATED AS A PROGN, THE VARIABLES UNBOUND TO THEIR OLD VALUES, AND THE VALUE OF THE LAST FORM IS RETURNED. EXAMPLE: (SETQ A 'FOO) (SETQ B 'BAR) (PROGV (LIST A B 'B) (LIST B) (LIST A B FOO BAR)) ==> (FOO NIL BAR NIL) [3] (MAPATOMS <FN>) MAPS THE FUNCTION <FN> OF ONE ARGUMENT OVER ALL SYMBOLS IN THE CURRENT OBARRAY, AND THEN RETURNS NIL. EXAMPLE: (MAPATOMS (FUNCTION (LAMBDA (X) (AND (= (FLATC X) 11.) (PRINT X))))) WOULD PRINT: NOINTERRUPT GC-OVERFLOW AND RETURN NIL. A SECOND ARGUMENT MAY BE SUPPLIED, WHICH MUST BE AN OBARRAY (*NOT* AN ATOM WITH AN OBARRAY AS AN ARRAY PROPERTY!!!). THE FUNCTION IS THEN MAPPED OVER THE SPECIFIED OBARRAY. [4] FLATC HAS SPECIAL SPEED-OF-LIGHT CODE FOR SYMBOLS, IN CASE ANYONE WANTS TO KNOW... ---------------------------------------------------------------- [A] THE EDIT PACKAGE NOW WORKS CORRECTLY IN NEWIO. [B] THE LOAD FUNCTION TAKES A NEWIO FILE NAME AS ITS ARGUMENT, AND ATTEMPTS TO LOAD IT UP. IF NO SECOND FILE NAME IS GIVEN, IT FIRST TRIES USING "FASL", AND THEN ">". AFTER FINDING THE FILE, IT DETERMINES WHETHER IT IS A FASL FILE OR NOT (BY LOOKING AT THE FIRST WORD). IF A FASL FILE, IT CALLS FASLOAD TO LOAD THE FILE. OTHERWISE, IT OPENS THE FILE AS AN ASCII FILE, PUSHES IT ON THE INSTACK, AND PERFORMS A READ-EVAL LOOP UNTIL END OF FILE. BECAUSE OF THIS MODE OF OPERATION, INCLUDE'S (SEE [C]) WILL WORK IN LOADED FILES. THE IDEA IS THAT YOU SAY (LOAD 'FOO) AND IT LOADS FOO. [C] INCLUDE IS A FEXPR WHICH TAKES A FILE NAME. (DEFUN INCLUDE FEXPR (X) (INPUSH (OPEN (CAR X)))) THAT IS, ONE TYPICALLY WOULD WRITE: (INCLUDE |DSK:GLS;FOO >|) OR WHATEVER. IF THIS IS EVALUATED IN THE COURSE OF UREAD'ING OR LOAD'ING A FILE, THE EFFECT IS TO INCLUDE THE TEXT OF THE INSERTED FILE IN PLACE OF THE INCLUDE. (OF COURSE, USER-SUPPLIED EOF HANDLERS MAY ALTER THIS SOMEWHAT.) EVENTUALLY THE @ PROGRAM WILL UNDERSTAND INCLUDE'S. [D] UREAD'S EOF HANDLER WAS FORMERLY DEFINED TO BE: (LAMBDA (FILE EOFVAL) (SETQ UREAD NIL)) IT IS NOW DEFINED TO BE: (LAMBDA (FILE EOFVAL) (SETQ UREAD NIL) EOFVAL) SO THAT READ OF ONE ARGUMENT WILL WORK CORRECTLY ON A UREAD FILE. [E] FILEPOS IS NOW IMPLEMENTED, EXCEPT THAT IT DOES NOT WORK YET TO TRY TO SET THE FILEPOS ON AN OUTPUT FILE. (ONE MAY READ THE CURRENT FILEPOS WHILE WRITING, HOWEVER.) FILEPOS MEASURES POSITION IN TERMS OF CHARACTERS FOR ASCII FILES, AND FIXNUMS (WORDS) FOR FIXNUM FILES. [F] (STATUS FILEMODE FOO) WILL RETURN THE FLAG "FILEPOS" IN THE CDR OF ITS RESULT IFF THE FILE FOO WILL WORK FOR BOTH READING AND SETTING THE FILEPOS.