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: Steve Haflich
Date: Wed, 23 Mar 2011 08:59:16 -0700
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".