[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#55395: What does (1 2 3 . #2) mean?
From: |
Andreas Schwab |
Subject: |
bug#55395: What does (1 2 3 . #2) mean? |
Date: |
Fri, 13 May 2022 18:08:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
On Mai 13 2022, Mattias Engdegård wrote:
> 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?
I don't think there is a defined meaning behind the number, it's more an
implementation detail. If you want to have precise cycle detection you
need to enable print-circle.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
- bug#55395: What does (1 2 3 . #2) mean?, Mattias Engdegård, 2022/05/13
- bug#55395: What does (1 2 3 . #2) mean?, Lars Ingebrigtsen, 2022/05/13
- bug#55395: What does (1 2 3 . #2) mean?, Stefan Monnier, 2022/05/13
- bug#55395: What does (1 2 3 . #2) mean?, Lars Ingebrigtsen, 2022/05/13
- bug#55395: What does (1 2 3 . #2) mean?, Mattias Engdegård, 2022/05/13
- bug#55395: What does (1 2 3 . #2) mean?, Stefan Monnier, 2022/05/14
- bug#55395: What does (1 2 3 . #2) mean?, Mattias Engdegård, 2022/05/18
- bug#55395: What does (1 2 3 . #2) mean?, Stefan Monnier, 2022/05/18
- bug#55395: What does (1 2 3 . #2) mean?, Mattias Engdegård, 2022/05/23
bug#55395: What does (1 2 3 . #2) mean?,
Andreas Schwab <=