How does `reverseLazy` defined as `for (value of iter) { yield* reverseLazy(iter); yield value; }` manage to reverse an iterable?
Summary The generator appears to “reverse” an iterable, but the behavior is actually an artifact of iterator exhaustion, recursive delegation, and JavaScript’s iteration semantics. The function does not truly reverse anything; instead, it repeatedly drains the same iterator until only the last value remains available, producing an output that looks reversed. Root Cause The core … Read more