/// <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);
public static Bag <bool> AllTrue(this Bag <bool> input) => input.Aggregate(true, (a, b) => a && b);
public static Bag <bool> AnyTrue(this Bag <bool> input) => input.Aggregate(false, (a, b) => a || b);
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);