#16 print-series shouldn't get stuck printing infinite series

closed-wont-fix
nobody
None
5
2008-01-09
2007-02-23
Anonymous
No

Unless *print-length* is non-nil, print-series will go into an infinite loop when printing an infinite series.

Tentative patch:

--- s-code.lisp 2005-11-15 10:07:57.000000000 -0500
+++ s-code-rme.lisp 2007-02-23 12:23:01.000000000 -0500
@@ -3788,7 +3788,7 @@
(cl:let ((generator (generator series)))
(write-string "#Z(" stream)
(do ((first-p t nil)
- (i (cond (*print-length*) (t -1)) (1- i)))
+ (i (cond (*print-length*) (t 1)) (1- i)))
(nil)
(cl:let ((element (next-in generator (return nil))))
(when (not first-p)

(I didn't look at the CMUCL-specific print-series.)

sbcl-1.0.2 and series-2.2.9 on Mac OS X 10.4.8.

R. Matthew Emerson
rme@thoughtstuff.com

Discussion

  • Raymond Toy
    Raymond Toy
    2007-07-31

    Logged In: YES
    user_id=28849
    Originator: NO

    Why should printing an infinite series be different from printing an infinite list?

    This change would make infinite series come out as #z(foo ...). Why cut off at 1? Why not 0? Or 10? Or 42? Or?

     
  • Raymond Toy
    Raymond Toy
    2008-01-09

    Logged In: YES
    user_id=28849
    Originator: NO

    Closing bug. Printing of infinite series will behave the same as printing of infinite lists.

     
  • Raymond Toy
    Raymond Toy
    2008-01-09

    • status: open --> closed-wont-fix