Why is *print-circle* set to T by default? WAS: grinding, etc.
Subject: Why is *print-circle* set to T by default? WAS: grinding, etc.
From: Stavros Macrakis
Date: Wed, 23 Mar 2011 12:26:05 -0400
Of course it is possible to create bad cases. But in realistic Maxima use,
the only commonly-encountered circular list structure is the 'assume'
database (data property).
A little experimentation shows that *print-level* = 14 gives a fairly
reasonable (though somewhat redundant) display, and *print-length* = 100 is
fine.
What other circular list structures are users like to encounter?
-s
On Wed, Mar 23, 2011 at 11:59, Steve Haflich <smh at franz.com> wrote:
> Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> I would recommend setting *print-length* and *print-level* pretty
> high. After all, the point here is simply to avoid infinite output,
> not to make it more readable. Real algebraic expressions easily hit
> even those limits.
>
> Say 100 and 20?
>
> You might be suprised. Try this experiment:
>
> (let ((*print-length* 10)
> (*print-level* 10)
> (*print-pretty* nil))
> (write '#1=(#1# . #1#))
> (values))
>
> Let me know what you think after it finishes printing. If you care to
> repeat the experiment with values 100 and 20, perhaps your grandchildren
> would be willing someday to report the result back to the Maxima list,
> which I'm sure will still be in business. :-)
>
> cl-user(24): (loop for lim from 1 to 8
> do (format t "~d: ~10:d~%"
> lim
> (length
> (with-output-to-string (s)
> (let ((*print-length* lim)
> (*print-level* lim)
> (*print-circle* nil)
> (*print-pretty* nil))
> (write '#1=(#1# . #1#) :stream s))))))
> 1: 7
> 2: 25
> 3: 131
> 4: 1,021
> 5: 10,935
> 6: 149,297
> 7: 2,470,627
> 8: 47,934,901
>
> Now, this experiment exploits an unlikely pathological case, but it
> shows that sometimes there is not a big difference between "infinite"
> and "large".
>