Esempio n. 1
0
        public SetsTest()
        {
            A = MathS.Union(A, new FiniteSet(3, 4, 5));
            A = MathS.Union(A, new Interval(10, true, 15, false));
            A = MathS.Union(A, new Interval(14, true, 19, false));
            // A = { 3, 4, 5 } \/ [10; 19)

            B = MathS.Union(B, new FiniteSet(11));

            C = MathS.Union(C, new Interval(-10, false, 10, true));
            C = MathS.Union(C, new Interval(-3, true, 3, false));
            // C = (-10; 10]
        }
 /// <summary>
 /// Unites your <see cref="IEnumerable"/> into one <see cref="Set"/>.
 /// Applies the "or" operator on those nodes
 /// </summary>
 /// <returns>A set of unique elements</returns>
 public static Set Unite(this IEnumerable <Set> sets)
 => sets.Any() ? sets.Aggregate((a, b) => MathS.Union(a, b)) : Empty;