[plt-scheme] Semantics of quote

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 24 01:28:00 EDT 2008

On Jun 24, Robby Findler wrote:
> 
> None of those seem like good ideas. I can see why you don't like that!
> I wouldn't suggest that. FWIW, you can actually try this stuff out.
> There's the constructor-style printing in drscheme where you get:

I know about it, of course, and it's a bad idea for general
hacking.

  (define (a) 1)
  (define (b) 2)
  (list a b)


> > IMO, if you add quote, you should go for the first option or
> > better not use pretty printing.  The contradicting goals are quote
> > trying to make results look like values and pretty-printing makes
> > them look like code.
> 
> "add quote" is the wrong way to put it, I believe. "Avoid removing
> quote" is the right way to say it, IMO. But that's just terminology.

I can say the opposite and have a perfectly valid view of the world...


> The contradiction is still manifest in what I'm suggesting, but it
> shows up in the choice of "quasiquote" printing vs "constructor
> style" printing. All I'm trying to fix is to make the output use
> input notation (I really just want input and output notation to
> match up and I suppose one coudl try to make input use the current
> output notation but that seems like the wrong choice.)

But that doesn't work for cases like functions and other unpritable
values.


On Jun 24, Robby Findler wrote:
> On Tue, Jun 24, 2008 at 12:10 AM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Jun 23, Robby Findler wrote:
> >> Oops, forgot to include this in my message below:
> >>
> >> Welcome to DrScheme, version 4.0.1-svn21jun2008 [3m].
> >> Language: Module custom; memory limit: 128 megabytes.
> >> > (list +)
> >> (list +)
> >
> > I take it that you'll want to see this then:
> >
> >  > '(+)
> >  (list '+)
> >  > ''(+)
> >  (list 'quote (list '+))
> >  > '''(+)
> >  (list 'quote (list 'quote (list '+)))
> >  > '(if (< x y) (+ x y) -1)
> >  (list 'if (list '< 'x 'y) (list '+ 'x 'y) -1)
> >
> > This is even worse.  I spent a few years working on getting the
> > advantages of a constant-size addition for quotation (where each level
> > of quotation can be represented by a constant (or at least linear)
> > addition) -- in other words, I spent nearly a decade talking about why
> > quoting is good, and you want to throw this natural advantage and
> > intentionally make it print with the exponential representation.
> 
> Quoting is good. Of course. I never said it wasn't. Let me remind you
> again about the quasiquote printer.
> 
> The "exponential representation" you're talking about is presumably
> situations like this:
> 
>   (define x1 (list 'x))
>   (define x2 (list x1 x1))
>   (define x3 (list x2 x2))
>   ..
>   (define xn (list xn-1 xn-1))
> ...

Not at all.  Using the above terms what I'm talking about is the fact
that with constructor style (and quasiquote style, for things that are
not lists), printout size is exponential to the level of quotedness,
because each construtor needs to be quoted itself.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.