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 6b09ec7 commit d18d8b1Copy full SHA for d18d8b1
src/functor.jl
@@ -13,10 +13,11 @@ end
13
14
# @leaf Any # every type is a leaf by default
15
16
+# Default functor
17
function functor(T, x)
18
names = fieldnames(T)
19
if isempty(names)
- return (), _ -> x
20
+ return NoChildren(), _ -> x
21
end
22
S = constructorof(T) # remove parameters from parametric types and support anonymous functions
23
vals = ntuple(i -> getfield(x, names[i]), length(names))
0 commit comments