wscl icon indicating copy to clipboard operation
wscl copied to clipboard

read-delimited-list and dotted lists

Open lassik opened this issue 3 years ago • 1 comments

CLHS does not say whether or not read-delimited-list can read dotted lists.

AFAICT, it implies by omission that a dotted list is not valid. CLISP and SBCL follow this interpretation.

lassik avatar Dec 17 '22 18:12 lassik

The algorithm of read-delimited-list is clearly specified in the description:

read-delimited-list looks ahead at each step for the next
non-whitespace[2] character and peeks at it as if with peek-char. If
it is char, then the character is consumed and the list of objects is
returned. If it is a constituent or escape character, then read is
used to read an object, which is added to the end of the list. If it
is a macro character, its reader macro function is called; if the
function returns a value, that value is added to the list. The
peek-ahead process is then repeated.

This algorithm is quite explicit, and leaves no room for parsing a dot and then a final object, and no room to return a dotted-list.

informatimago avatar Dec 17 '22 19:12 informatimago