Re: Wow, Lisp Reader !!
"Marco Antoniotti (as marco dot antoniotti at unimib dot it)" <[email protected]> Sun, 24 May 2026 11:31:31 +0200
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <CAG0Nw2meURWBpZbsNVAOw1E1hRADP2RdYwZejMtwDCmoSgLROw@mail.gmail.com> |
My 0.02 EUR opinion is that reader macros do get you quite a lot. Incidentally the #I for infix (math) has been around for ages; check the CMU repository. What I noticed is that Julia takes one step more. you write #symbol... so you have "reader dispatching "symbols". Which opens up many doors (some with monsters behind, but ...) Cheers Marco On Sun, May 24, 2026 at 10:58 AM Tim Bradshaw (as tfb at cley dot com) < [email protected]> wrote: > On 23 May 2026, at 23:18, David McClain (as dbm at refined-audiometrics > dot com) <[email protected]> wrote: > > > Perhaps I just need to polish it a bit harder. For the embedded colon > chars in my angle input, I currently have to write #N|12:42:33.25| or > #N”12:42:33.25” so that I have either a symbol or a string to take apart. > But if I back up a bit and do the read-chars myself, then I ought to be > able to get around this. > > > The problem with this is that you need to know when to stop. Presumably > '#N12:42:123(' is legal (leaving an open paren to be read, so the next form > to be read being a list) but '#N12:42:123x' should not be. > > You really need access to the syntax types of characters and you don't > have that. > > I'm guessing that the reason it's all so opaque is that the reader only > has to behave *as if* the things the spec describes are true: it might > internally be doing something quite different, especially for interactive > use. Exposing more of it would tend to force it to *actually* behave the > way it's meant to, which would constrain implementations a lot more. > > But it's annoying. What I do is the delimiter thing: write something that > will read characters up to an unescaped delimiter and hand them to whatever > it is. So my syntax would be '#N[...]', or '#N/.../' read-delimited-list > is not how you need to do this because the characters you read need to be > uninterpreted. > > --tim > -- Marco Antoniotti, Professor, Director tel. +39 - 02 64 48 79 01 DISCo, University of Milan-Bicocca U14 2043 http://dcb.disco.unimib.it Viale Sarca 336 I-20126 Milan (MI) ITALY REGAINS: https://regains.disco.unimib.it/