Re: Wow, Lisp Reader !!

"Tim Bradshaw (as tfb at cley dot com)" <[email protected]> Sun, 24 May 2026 09:56:23 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
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