GNU bug report logs -
#55395
What does (1 2 3 . #2) mean?
Previous Next
Full log
View this message in rfc822 format
What, exactly, does the #N print notation mean (with print-circle=nil)?
Let's define (rho LEAD LOOP) as the iota list that has a loop LOOP long after LEAD initial elements:
(defun rho (lead loop)
(let ((l (number-sequence 1 (+ lead loop))))
(setcdr (nthcdr (+ lead loop -1) l) (nthcdr lead l))
l))
Then we have:
(rho 0 1) => (1 . #0)
(rho 0 2) => (1 2 1 2 . #2)
(rho 0 3) => (1 2 3 1 2 . #2)
(rho 0 4) => (1 2 3 4 1 2 3 4 1 2 . #5)
(rho 0 5) => (1 2 3 4 5 1 2 3 4 5 1 . #5)
(rho 1 4) => (1 2 3 4 5 2 3 4 5 2 . #5)
(rho 4 1) => (1 2 3 4 5 5 5 . #3)
and so on. The pattern is not obvious to me.
It may have made more sense before the switch of cycle-detection algorithm from Floyd to Brent. This can be fixed by hand-coding the list iteration and explicitly remembering the index of the tortoise, but would that be correct? What's the spec?
If #N means 'Nth object from the top along the path to the current object, starting at 0' then we should have
(rho 2 3) => (1 2 3 4 5 . #2)
(list (rho 2 3)) => ((1 2 3 4 5 . #3))
ie, adding the print depth to the index in the list. Do you agree?
This bug report was last modified 3 years and 24 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.