1+ _map (f, x... ) = map (f, x... )
2+ _map (f, x:: Dict , ys... ) = Dict (k => f (v, (y[k] for y in ys). .. ) for (k, v) in x)
3+
4+ _values (x) = x
5+ _values (x:: Dict ) = values (x)
6+
17"""
28 AbstractWalk
39
@@ -22,7 +28,7 @@ abstract type AbstractWalk end
2228 AnonymousWalk(walk_fn)
2329
2430Wrap a `walk_fn` so that `AnonymousWalk(walk_fn) isa AbstractWalk`.
25- This type only exists for backwards compatability and should be directly used.
31+ This type only exists for backwards compatability and should not be directly used.
2632Attempting to wrap an existing `AbstractWalk` is a no-op (i.e. it is not wrapped).
2733"""
2834struct AnonymousWalk{F} <: AbstractWalk
@@ -53,7 +59,7 @@ struct DefaultWalk <: AbstractWalk end
5359function (:: DefaultWalk )(recurse, x, ys... )
5460 func, re = functor (x)
5561 yfuncs = map (y -> functor (typeof (x), y)[1 ], ys)
56- re (map (recurse, func, yfuncs... ))
62+ re (_map (recurse, func, yfuncs... ))
5763end
5864
5965"""
@@ -66,7 +72,7 @@ See [`fmapstructure`](@ref) for more information.
6672"""
6773struct StructuralWalk <: AbstractWalk end
6874
69- (:: StructuralWalk )(recurse, x) = map (recurse, children (x))
75+ (:: StructuralWalk )(recurse, x) = _map (recurse, children (x))
7076
7177"""
7278 ExcludeWalk(walk, fn, exclude)
@@ -156,7 +162,7 @@ function (walk::CollectWalk)(recurse, x)
156162 # to exclude, we wrap this walk in ExcludeWalk
157163 usecache (walk. cache, x) && push! (walk. cache, x)
158164 push! (walk. output, x)
159- map (recurse, children (x))
165+ _map (recurse, children (x))
160166
161167 return walk. output
162168end
0 commit comments