From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: how to quote #.?
Date: 
Message-ID: <d3picp$ckl$1@ulric.tng.de>
Out of curiosity:
what form do I need to evaluate to get (a b c 1 #.(+ 1 1)) ?
I tried '(a b c 1 #.(+ 1 1)) which becomes (A B C 1 2)


Andr�
--

From: Barry Margolin
Subject: Re: how to quote #.?
Date: 
Message-ID: <barmar-C4B778.20170715042005@comcast.dca.giganews.com>
In article <············@ulric.tng.de>,
 Andr� Thieme <······························@justmail.de> wrote:

> Out of curiosity:
> what form do I need to evaluate to get (a b c 1 #.(+ 1 1)) ?
> I tried '(a b c 1 #.(+ 1 1)) which becomes (A B C 1 2)

There is no form that will do what you want.  #. is a reader macro, and 
it has no corresponding list structure.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: Iain Little
Subject: Re: how to quote #.?
Date: 
Message-ID: <87u0m78p0x.fsf@yahoo.com>
Andr� Thieme <······························@justmail.de> writes:

> Out of curiosity:
> what form do I need to evaluate to get (a b c 1 #.(+ 1 1)) ?
> I tried '(a b c 1 #.(+ 1 1)) which becomes (A B C 1 2)

The #. reader macro does an read-time evaluation --- the reader itself
causes the form that comes after it to be evaluated, and so it can't
be quoted.  It is possible to turn of read-time evaluation off (by
setting *READ-EVAL* to NIL), but this doesn't quite do what you asked
for, as an error is returned instead.

However, it should be possible to achieve what you asked for by
hacking the readtable so that `#.' returns a symbol.  (Lookup
SET-DISPATCH-MACRO-CHARACTER --- GET-MACRO-CHARACTER and
COPY-READTABLE would probably also be useful...)

[This is all dubious, though: if you want something to be explicitly
evaluated, but not at read time, then you should probably use EVAL.
If you accept that you should think twice before using EVAL, then this
applies doubly so to `#.'.]


Iain
From: Iain Little
Subject: Re: how to quote #.?
Date: 
Message-ID: <87pswv8o9o.fsf@yahoo.com>
Iain Little <······@yahoo.com> writes:

> Andr� Thieme <······························@justmail.de> writes:
>
>> Out of curiosity:
>> what form do I need to evaluate to get (a b c 1 #.(+ 1 1)) ?
>> I tried '(a b c 1 #.(+ 1 1)) which becomes (A B C 1 2)

[...]

> However, it should be possible to achieve what you asked for by
> hacking the readtable so that `#.' returns a symbol.  (Lookup
> SET-DISPATCH-MACRO-CHARACTER --- GET-MACRO-CHARACTER and
> COPY-READTABLE would probably also be useful...)

I forgot to add, to actually get the `#.' to do the evaluation later,
you would have to READ the expression again with the original
readtable.  (Presumably after printing it out somewhere --- would also
need to make sure that `#.' doesn't get printed as `|#.|'.)  Whatever
you are trying to achieve, there is probably an easier way...


Iain
From: Pascal Bourguignon
Subject: Re: how to quote #.?
Date: 
Message-ID: <871x9a92pm.fsf@thalassa.informatimago.com>
Iain Little <······@yahoo.com> writes:

> Iain Little <······@yahoo.com> writes:
> 
> > Andr� Thieme <······························@justmail.de> writes:
> >
> >> Out of curiosity:
> >> what form do I need to evaluate to get (a b c 1 #.(+ 1 1)) ?
> >> I tried '(a b c 1 #.(+ 1 1)) which becomes (A B C 1 2)
> 
> [...]
> 
> > However, it should be possible to achieve what you asked for by
> > hacking the readtable so that `#.' returns a symbol.  (Lookup
> > SET-DISPATCH-MACRO-CHARACTER --- GET-MACRO-CHARACTER and
> > COPY-READTABLE would probably also be useful...)
> 
> I forgot to add, to actually get the `#.' to do the evaluation later,
> you would have to READ the expression again with the original
> readtable.  (Presumably after printing it out somewhere --- would also
> need to make sure that `#.' doesn't get printed as `|#.|'.)  Whatever
> you are trying to achieve, there is probably an easier way...

Since #. is a reader macro and you want to READ the expression, then
put it into a string:

    "(a b c 1 #.(+ 1 1))"  ; this is the form you need to evaluate.

Then read it:

    (read-from-string "(a b c 1 #.(+ 1 1))")

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we. -- Georges W. Bush