Created
June 3, 2021 00:43
-
-
Save thundergnat/77676d999d06fbf8152ec0e25e55ce92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi expand-tree ( Bag $tree ) { | |
bag(bag(bag()) (+) $tree) (+) | |
[(+)] ( | |
$tree.keys ==> map { | |
$^a.&expand-tree.map: * (+) ( $tree (-) bag($^a) ) | |
} | |
); | |
} | |
multi expand-trees ( Bag $trees ) { | |
[(+)] $trees.keys.map: { .&expand-tree } ; | |
} | |
my $n = 5; | |
for ( bag(), bag(bag()), *.&expand-trees ... * )[$n] { | |
print ++$,".\t"; | |
.say | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment