That may indeed explain why it works the way it does, but that doesn't mean it isn't a bug. IMO it certainly is; [X] and [X*] don't work as advertised.

Let me explain how I found this bug.
I'm generating a list of divisors for a number. I already have the prime factorization of that number, and a list of all the "prime powers".
Examples:
  24 = 2³×3¹: ((1, 2, 4, 8), (1, 3))
  42 = 2¹×3¹×7: ((1, 2), (1, 3), (1, 7))
  64 = 2⁶: ((1, 2, 4, 8, 16, 32, 64),)
Now it's easy to generate the divisors:

> say [X*] ((1, 2, 4, 8), (1, 3));
(1 3 2 6 4 12 8 24)

> say [X*] ((1, 2), (1, 3), (1, 7));
(1 7 3 21 2 14 6 42)

> say [X*] ((1, 2, 4, 8, 16, 32, 64),)
(2097152)
Oops...

Reply via email to