Actually, it might be simpler to elide both functions and just build the iterators in your `sort` function.