コード例 #1
0
 public TreeMap <k, v> Singleton(k key, v value, ROrder <k, Unit> ord = null) => New(ord, WBT <Pair <k, v> > .Singleton(Ctors.Pair(key, value)));
コード例 #2
0
 public TreeSet <v> Singleton(v value, ROrder <v, Unit> ord = null) => New(ord, WBT <v> .Singleton(value));
コード例 #3
0
 private static WBT <Pair <k, v> > .N Alter(Func <k, Ord> p, k key, Func <Opt <v>, Opt <v> > f, WBT <Pair <k, v> > .N t) =>
 WBT <Pair <k, v> > .Tip(t)
         ? (f(Ctors.None())).Case(_ => WBT <Pair <k, v> > .Tip(), (v vv) => WBT <Pair <k, v> > .Singleton(Ctors.Pair(key, vv)))
         : (p(t.v.Left()).Case(
                _ => WBT <Pair <k, v> > .Balance(t.v, Alter(p, key, f, t.l), t.r),
                _ => f(Ctors.Some(t.v.Right())).Case(
                    __ => WBT <Pair <k, v> > .Glue(t.l, t.r),
                    vv => WBT <Pair <k, v> > .Bin(t.s, Ctors.Pair(key, vv), t.l, t.r)),
                _ => WBT <Pair <k, v> > .Balance(t.v, t.l, Alter(p, key, f, t.r))));