On Fri, 2024-08-16 at 12:09 +0200, 'Axel Wagner' via golang-nuts wrote:
> Or with half the allocations: https://go.dev/play/p/LmtNdR-hfWY
> I can't get it down to 1 allocation, which should be the theoretical
> minimum, as I can't get the compiler to move the closure and the
> state being closed over into one allocation.

Pascal's observation that pull iterators were what I was looking for it
really the answer here. We have a pull iterator based on reflect
already; this is easy since the reflect map iterator is already a pull
iterator. The issue was how to get language-level map iteration to be
passable as a first class iterator.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9e3f8be52cb62c15799eeeb2ab168d9ed5c829dd.camel%40kortschak.io.

Reply via email to