def exhaust(f): tree = ChoiceTree() results = [] prefix = () while not tree.exhausted: prefix = tree.step(prefix_selection_order(prefix), lambda chooser: results.append(f(chooser))) return results
def select(*args): return prefix_selection_order(args)