예제 #1
0
 /// <summary>
 /// See also https://msdn.microsoft.com/en-us/library/bb352408(v=vs.110).aspx
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="input"></param>
 /// <returns></returns>
 public static Bag <Option <T> > Min <T>(this Bag <T> input)
     where T : IComparable
 => input.Aggregate((a, b) => a.CompareTo(b) <= 0 ? a : b);
예제 #2
0
 public static Bag <bool> AllTrue(this Bag <bool> input)
 => input.Aggregate(true, (a, b) => a && b);
예제 #3
0
 public static Bag <bool> AnyTrue(this Bag <bool> input)
 => input.Aggregate(false, (a, b) => a || b);
예제 #4
0
 public static Bag <T> Sum <P, T>(this P policy, Bag <T> input)
     where P : struct, INumericPolicy <T>
 => input.Aggregate(policy.FromLong(0), policy.Plus);