Skip to content

Instantly share code, notes, and snippets.

@thundergnat
Created June 3, 2021 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thundergnat/77676d999d06fbf8152ec0e25e55ce92 to your computer and use it in GitHub Desktop.
Save thundergnat/77676d999d06fbf8152ec0e25e55ce92 to your computer and use it in GitHub Desktop.
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