From: Dorai Sitaram
Subject: reading dotdotdot
Date: 
Message-ID: <1992Mar25.200926.18439@rice.edu>
Could a helpful soul tell me how to make the CL reader read the token
... without barfing?  It is immaterial what form this action produces
-- it may produce the symbol \... or the keyword :etc but nil or 42 is
fine too --; I just don't want a reader error.

(As background, I have code that could be read by either Scheme or CL.
... is a valid and oft-used symbol in Scheme.  I'd like the CL reader
to chew past such code without my having to resort to reading
characters.

I tried using \... in my Scheme code, but Schemes like MIT Scheme and
Jaffer's SCM don't treat ... and \... as eq? symbols.  R4rs doesn't
force them to, either.)

--d
-- 

·····@titan.rice.edu   !    It may be that the gulfs will wash us down;
·····@owlnet.rice.edu  !      it may be we shall touch the Happy Isles.

From: Len Charest
Subject: Re: reading dotdotdot
Date: 
Message-ID: <1992Mar25.223300.22566@jpl-devvax.jpl.nasa.gov>
In article <······················@rice.edu>, ·····@tone.cs.rice.edu (Dorai Sitaram) writes:
|> Could a helpful soul tell me how to make the CL reader read the token
|> ... without barfing? 

From CLtL2, p 520: 'If a token consists solely of dots (with no escape characters), then an error is signaled, except...if the token is a single dot and occurs in a situation appropriate to "dotted list" syntax.'

So this is actually a feature!

One possible fix is to trap the error condition generated by your LISP when ... is read. Unfortunately, the condition type is probably nothing more specific than SIMPLE-ERROR.
..................................................
                                  Len Charest, Jr.
                 JPL Artificial Intelligence Group
                          ·······@aig.jpl.nasa.gov
From: Barry Margolin
Subject: Re: reading dotdotdot
Date: 
Message-ID: <kt25qbINNbi@early-bird.think.com>
In article <······················@rice.edu> ·····@tone.cs.rice.edu (Dorai Sitaram) writes:
>Could a helpful soul tell me how to make the CL reader read the token
>... without barfing?  It is immaterial what form this action produces
>-- it may produce the symbol \... or the keyword :etc but nil or 42 is
>fine too --; I just don't want a reader error.

This is hard to do without interfering with all the other uses of ., such
as the consing dot and decimal point in numbers.
I.e. you could do

(set-syntax-from-char #\. #\a) ; treat . as a normal constituent character

but then you get

'(foo . ()) => (FOO |.| NIL) ; instead of (FOO)

'1.2 => |1.2| ; intead of 1.2
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar
From: Sandra Loosemore
Subject: Re: reading dotdotdot
Date: 
Message-ID: <1992Mar26.014730.14449@cs.yale.edu>
······@think.com (Barry Margolin) writes:

   This is hard to do without interfering with all the other uses of ., such
   as the consing dot and decimal point in numbers.
   I.e. you could do

   (set-syntax-from-char #\. #\a) ; treat . as a normal constituent character

This won't work because #\. is already a constituent in the standard
readtable.  It's the tokenizer that signals the error when a token consists
of (unescaped) dots, and the tokenizer is the one aspect of the reader
that cannot be changed.

As I already suggested in an e-mail response to the person who
originally posted the question, a more productive approach would be to
define #\. as a non-terminating macro character, with some appropriate
hacks so the list reader will still recognize dotted-list syntax.

-Sandra