public static TreeForest <A> Flatten <A>(this TreeForest <TreeForest <A> > o) { return(o.SelectMany(z => z)); }
public static Pair <TreeForest <A>, TreeForest <B> > Unzip <A, B>(this TreeForest <Pair <A, B> > p) { return(Pair <TreeForest <A>, TreeForest <B> > .pair(p.Select(a => a._1.Get), p.Select(a => a._2.Get))); }
public static TreeForest <B> Apply <A, B>(this TreeForest <Func <A, B> > f, TreeForest <A> o) { return(f.SelectMany(g => o.Select(p => g(p)))); }
public static TreeForest <C> SelectMany <A, B, C>(this TreeForest <A> k, Func <A, TreeForest <B> > p, Func <A, B, C> f) { return(SelectMany(k, a => Select(p(a), b => f(a, b)))); }
public static TreeForest <B> SelectMany <A, B>(this TreeForest <A> k, Func <A, TreeForest <B> > f) { return(k.Forest.Get.SelectMany(t => TreeT(a => f(a).Forest.Get, t)).Forest()); }
public static TreeForest <B> Select <A, B>(this TreeForest <A> k, Func <A, B> f) { return(k.Forest.Get.Select(q => q.Select(f)).Forest()); }
public static TreeForest <A> Flatten <A>(this TreeForest <TreeForest <A> > o) => o.SelectMany(z => z);