Re: Wow, Lisp Reader !!

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Sun, 24 May 2026 07:14:44 -0700
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>

> On May 24, 2026, at 02:29, Pascal Bourguignon <[email protected]> wrote:
> 
> (defun install-angle-reader (&optional (readtable *readtable*))
>   "Install the angle reader macro on digits and signs."
>   (dolist (c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\+ #\-)) ; <- the magic is here ;-)
>     (set-macro-character c #'read-angle-or-fallback t readtable))
>   readtable)
> 


Now this is interesting, but it also illustrates the control point I just described. As long as you are inside a Reader Macro, you have absolute control. Pascal has exerted the control on individual digit chars. That seems a brilliant way to approach things!

Your point about prefix mapping the parser might be theoretically valid, i.e., first two chars determines the route. But in practice, LW Reader also uses the special chars for stopping parses. That is to say that a Quote will stop an ongoing number parse, unless you preemptively take control through a reader macro doing READ-CHAR. Depending on the Reader at the READ level will fail your intentions.