`fcollect` won't keep repeated arrays that are `==` but distinct
ericphanson opened this issue · 1 comments
ericphanson commented
See beacon-biosignals/LegolasFlux.jl#4 (comment) and the alternate implementation
function fcollect2(x; output = [], cache = Base.IdSet(), exclude = v -> false)
x in cache && return output
if !exclude(x)
push!(cache, x)
push!(output, x)
foreach(y -> fcollect2(y; cache = cache, output=output, exclude = exclude), Functors.children(x))
end
return output
end
DhairyaLGandhi commented
A pr would be great with a small mwe from beacon-biosignals/LegolasFlux.jl#4 (comment) @ericphanson !