Lazy map/broadcast/filter etc

Hi. This is a stupid question but I’m exploring options for a lazy version of broadcast, filter, etc in ChainMap.jl . So for example I have:

I = [1, 2]
J = [3, 4]
@chain begin
    @over ~I + ~J
    @over _ > 5 filter
end

going to

I = [1, 2]
J = [3, 4]
filter(k -> k > 0, broadcast( (i, j) -> i + j, I, J) )

but I’m wondering if there’s a way to do this that avoids allocations? Maybe via generators?

1 Like