lib/RoseTree.js
function filterSubtrees(pred, tree) {
  return new RoseTree(
    tree.root,
    function() {
      return tree.children().filter(function(subtree) {
        return pred(subtree.root);
      }).map(filterSubtrees.bind(null, pred));
    }
  );
}
function filterSubtrees(pred, tree) {
  return new RoseTree(
    tree.root,
    function() {
      return tree.children().filter(function(subtree) {
        return pred(subtree.root);
      }).map(filterSubtrees.bind(null, pred));
    }
  );
}
RoseTree a -> (a -> Bool) -> RoseTree a