type: keyword location: built-in source file: xlread.c Common LISP compatible: no supported on: all machines
(:nmacro . <function> ) <function> - a function
:NMACRO is an entry that is used in the *READTABLE*. *READTABLE* is a system variable that contains XLISP's data structures relating to the processing of characters from the user (or files) and read-macro expansions. The existance of the :NMACRO keyword means that the specified character is the start of a non-terminal macro. For :NMACRO, the form of the *READTABLE* entry is a dotted pair like (:NMACRO . <function> ). The <function> can be a built-in read-macro function or a user defined lambda expression. The <function> takes two parameters, an input stream specification, and an integer that is the character value. The <function> should return NIL if the character is 'white-space' or a value CONSed with NIL to return the value. The <function> will probably read additional characters from the input stream.
(defun look-at (table) ; define a function to (dotimes (ch 127) ; look in a table (prog ( (entry (aref table ch)) ) ; and print out any (if (and (consp entry) ; :NMACRO entries (equal (car entry) ; ':NMACRO)) ; (princ (int-char ch))))) ; (terpri)) ; ; (look-at *readtable*) ; prints #
NOTE: The system defines that the hash (#) character is a non-terminal. This is because the hash is used for a variety of 'read macro expansions' including FUNCTION, an ASCII code, and hexadecimal numbers.
CAUTION: If you experiment with *READTABLE*, it is useful to save the old value in a variable, so that you can restore the system state.