Re: Wow, Lisp Reader !!
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Sun, 24 May 2026 07:32:55 -0700
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Point of curiosity… I see that the Lisp community has chosen to allow not only whitespace, but also parentheses, as parse stopping point. Totally reasonable, given the basis of the language in Sexprs. But why also Quote, Backquote? Also Semicolon - seems reasonable. Comma and Vertical Bar? I can easily envision wanting symbol names ending in a quote, as in X’ (for x-prime). > On May 24, 2026, at 07:14, David McClain (as dbm at refined-audiometrics dot com) <[email protected]> wrote: > > > >> 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.