To quote or not to quote, that is the question David Van Horn (18 Sep 2009 20:48 UTC)
Re: To quote or not to quote, that is the question Alexey Radul (19 Sep 2009 03:33 UTC)
Re: To quote or not to quote, that is the question David Van Horn (19 Sep 2009 13:23 UTC)
Re: To quote or not to quote, that is the question Robby Findler (19 Sep 2009 13:34 UTC)
Re: To quote or not to quote, that is the question David Van Horn (19 Sep 2009 13:49 UTC)
Re: To quote or not to quote, that is the question Shiro Kawai (19 Sep 2009 14:11 UTC)
Re: To quote or not to quote, that is the question David Van Horn (19 Sep 2009 16:04 UTC)

Re: To quote or not to quote, that is the question David Van Horn 19 Sep 2009 13:23 UTC

Alexey Radul wrote:
> On Fri, Sep 18, 2009 at 4:48 PM, David Van Horn
> <xxxxxx@cs.brandeis.edu> wrote:
>> It is not possible to define a correct implementation of `quote' which
>> produces random-access pairs as a library form
>
> This may be a stupid question: why not define random-access-quote to
> use the standard quote and convert the result into a random-access
> list?  (This may involve recurring inside the elements of literal
> vectors, but so be it).

It's not stupid at all.  The issue is that quoted a constant must always
be `eq?' to itself.  So for example:

    (define (f) '(x))
    (eq? (f) (f))             => #t

Compared to:

    (define (f) (cons 'x '())
    (eq? (f) (f))             => #f

If you look at the formal semantics of R6RS, you'll notice the
metafunctions that lift quoted constants to the top so they are
evaluated only once before they are expanded to constructors.  You can't
do that lifting with a macro.  It's my understanding that with
single-instantiation library semantics, you could achieve the right
behavior by making a table, but that since implementations are not
required to use single instantiation, this approach is not portable.

Perhaps a macro wizard can prove me wrong.  I would like that.  But I'm
pretty sure you just can't make a quote-like macro in a portable way,
which is too bad.

David