Re: Wow, Lisp Reader !!
"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Sun, 24 May 2026 12:34:06 -0700
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
OMG!! Guys! This is fabulous !!! Thanks to Pascal for enlightening the way forward. And after a little careful work regarding when and which readtable is in place, I now have a wonderful REPL - even better than Forth ever was! I not only have sexagisimal number input, but I also have C-like syntax 0x100, 0b1_0000_0000, and complex numbers like 1+2j, and dates like 2026/05/24, and arbitrary numbers with #\_ spacers 3.141_592_6 This is a dream come true!! I cannot imagine moving to any other language than Lisp. > On May 24, 2026, at 08:14, Tim Bradshaw (as tfb at cley dot com) <[email protected]> wrote: > > I think it definitely is the case that the CL reader is not as general-purpose as some parts of the spec might lead you to think: it's really good for things which are pretty like CL's standard syntax with may be some special additions. > >> On 24 May 2026, at 15:51, David McClain <[email protected]> wrote: >> >> Wow!! You guys have been wonderful and amazing with all your suggestions. I see that I have been too limited in my approaches. >> >> I’m really glad I spoke up. Even after 30 years of Lisp experience there is still so much to learn. Pascal, I admire the code you sent along for parsing angles! >> >> Now here’s the next challenge - can you do a Vulcan mind meld on the user, from the reader, to ascertain Right Ascension from Declination? Hours are stated as 1/15 of Degrees, so 12 hours is the same as 180 degrees. But they appear the same with sexigisimal syntax, 12:00 versus 180:00. >> >> >> >>> On May 24, 2026, at 07:40, Tim Bradshaw <[email protected]> wrote: >>> >>> (defvar *rt* (copy-readtable nil)) >>> >>> (set-macro-character >>> #\' >>> (get-macro-character #\' *readtable*) >>> t *rt*) >>> >>> Now >>> >>> ? (setf *readtable* *rt*) >>> #<readtable 8170521CF3> >>> >>> ? 'foo'bar'bang >>> foo\'bar\'bang >>> >>> Same for the others. You just need to make the read-macros be nonterminating. >>> >>