treelike tuples
This commit is contained in:
parent
e943a39ee7
commit
0f8ba87dc6
|
@ -1,6 +1,9 @@
|
|||
children(x) = ()
|
||||
mapchildren(f, x) = x
|
||||
|
||||
children(x::Tuple) = x
|
||||
mapchildren(f, x::Tuple) = map(f, x)
|
||||
|
||||
function treelike(T, fs = fieldnames(T))
|
||||
@eval begin
|
||||
children(x::$T) = ($([:(x.$f) for f in fs]...),)
|
||||
|
|
Loading…
Reference in New Issue