public static TResult Cata <N, L, TResult>( this IRoseTree <N, L> tree, Func <N, IEnumerable <TResult>, TResult> node, Func <L, TResult> leaf) { return(tree.Accept(new CataVisitor <N, L, TResult>(node, leaf))); }
public void MatchNode() { IRoseTree <string, int> tree = RoseTree.Node("foo", new RoseLeaf <string, int>(42), new RoseLeaf <string, int>(1337)); int actual = tree.Accept(new MatchStringNodeVisitor()); Assert.Equal(3, actual); }
public static IChurchBoolean IsLeaf <N, L>(this IRoseTree <N, L> source) { return(source.Accept(new IsLeafVisitor <N, L>())); }