[plt-scheme] Semantics of quote

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Jun 24 01:11:39 EDT 2008

On Tue, Jun 24, 2008 at 12:01 AM, Eli Barzilay <eli at barzilay.org> wrote:
> On Jun 23, Robby Findler wrote:
>> (list +) is fine.
>
> If it's
>
>  '(+)
>
> then how is this different than (list '+); and if it's
>
>  '(#<procedure:+>)
>
> then the quote is meaningless as a consructor (eg, you can't copy the
> result as an expression) and you'll also want
>
>  '#<procedure:+>
>
> which quickly turns it into a character displayed in front of all
> values, which makes little sense.

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:

  > (list +)
  (list +)
  > `(,+)
  (list +)

and there's the quasiquote style printing where you get:

  > (list +)
  `(,+)
  > `(,+)
  `(,+)

>> In general, there are exactly as many unprintable values as there
>> were before, I believe (or at least there should be
>> ...).
>
> Obviously.  Same as any output prefix.

Sorry, I took that comment from you as a reason why you didn't like my
suggestion.

>> Pretty-printing also seems okay, but I'm not sure where you're going
>> with that one.
>
> Assuming a narrow screen, how does (list 'define 'define 'define)
> print:
>
>  '(define
>    define
>    define)
>
> or
>
>  '(define define
>     define)

That isn't specific to the printing style I'm proposing. Pretty-print
with or without stripping off the quote still has issues.

> 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.

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.)

Robby


Posted on the users mailing list.