Using READER macros then is best used to write syntax extensions for data or alternative syntax for data.
Example: implement a JSON reader.
Using READER macros then is best used to write syntax extensions for data or alternative syntax for data.
Example: implement a JSON reader.
The reader does not know about functions.
Something like
(defun foo (bar) (+ bar 10))
is for the reader just another list. It does not know that the first symbol has to be DEFUN, that the next item needs to be a symbol, that the next item is a list of arguments and that then a sequence of body expressions follows.Something like
(defun (bar) foo + (bar 10))
is also a valid list, but it is not a valid Lisp expression. The reader does not know that.The reader does not know anything about Lisp. All the reader knows is data. It does not know about LET, nothing about LAMBDA, has no idea about DEFUN, does not know what an argument list is, it has no idea what a class is, ...
The only thing about the Lisp language the reader actually knows are abbreviations for QUOTE and FUNCTION. Everything else in the reader is about data representation: syntax for lists, numbers, symbols, characters, strings, bitvectors, structures, ... The reader has no parser for functions, definitions, special forms, macros or other Lisp language constructs.