emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: print-circle and describe-variable


From: Drew Adams
Subject: RE: print-circle and describe-variable
Date: Tue, 10 Apr 2007 08:50:56 -0700

> >>>> But the result I see is
> >>>>
> >>>>    (#1=(2) #1#)((2) (2))
> >>>>
> >>>> Why are the two printed representations of toto different?
> >>> I think you are seeing: 1) the side-effect result of `prin1' printing,
> >>> followed by 2) the returned value, printed normally. (#1=(2)
> >>> #1#) is the former; ((2) (2)) is the latter.
> >>
> >> But it is the output of (prin1 (list toto toto)), isn't it?
> >
> > I'm not sure what you mean (by "it" and by "the output", for instance).
> >
> > During the invocation of `prin1', the `print-circle' binding is
> > in effect, so (#1=(2) #1#) is what is printed (by the side effect
> > of `prin1').
> >
> > The binding is finished after the expression evaluation, and
> > that is when the command loop prints the value that is returned
> > by the expression. Printing of this value is thus done using
> > the default value of `print-circle', nil, so you see ((2) (2)).
>
> Yes, but the let binding is in effect when printing the second toto too,
> or? The argument to print1 is (list toto toto).

I probably still don't understand what you're saying. HTH:

toto = (2)
(list toto toto) = ((2) (2))

(list toto toto) is printed twice when you eval the overall `let'
expression:

* First, by `prin1', within a context where `print-circle' = t. The printout
is (#1=(2) #1#). You don't explicitly see the value of toto printed twice
here, as (2) each time, because that's how `print-circle' works: it
represents the list without showing the normal, full representation of each
list element; it uses #1 as an abbreviation (placeholder) for the first
element, and so on.

* Second, by the command loop, in a context where `print-circle' = nil. The
printout is ((2) (2)). Here, you see the value of toto printed twice
explicitly, and it is printed the same each time.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]