We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b020163 commit 254dea1Copy full SHA for 254dea1
src/functor.jl
@@ -193,6 +193,9 @@ julia> fcollect(m, exclude = v -> Functors.isleaf(v))
193
```
194
"""
195
function fcollect(x; output = [], cache = Base.IdSet(), exclude = v -> false)
196
+ # note: we don't have an `OrderedIdSet`, so we use an `IdSet` for the cache
197
+ # (to ensure we get exactly 1 copy of each distinct array), and a usual `Vector`
198
+ # for the results, to preserve traversal order (important downstream!).
199
x in cache && return output
200
if !exclude(x)
201
push!(cache, x)
0 commit comments