Hi Tomas,

> I don't think so.  I have simple rules for the reader:
> - dot is a symbol as any other
> - if read inside a list, it means: place the next sexp into the current
>   cells' cdr
> ...
> Why error?  Understanding of the three simple rules above is enough and
> there are not any surprises and pathological cases.

There are. You gave (1 2 3 . 4 . 5) as an example.

Your algorithm first replaces the cdr of the last cell of (1 2 3) with
'4', and then with '5'. So ". 4" is discarded.

You violated your own rule, in that the "next sexp" is placed into the
current cell's cdr, because precisely that sexp (the '4') gets lost.

A naive user seeing the above expression would rather assume the first
dot to be a normal symbol ("dot is a symbol as any other"), and the
second dot to be the markup of a dotted pair. But implementing this
would require a read-ahead to find the last dot in an expression.

Or he would assume that the first dot is indeed a markup character, and
(4 . 5) is the "next sexp", but this is also not correct because then
the expression should be written as (1 2 3 . (4 . 5)).

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to