Beispiel #1
0
 public static SELF subtract <SELF, FLOAT, A, PRED>(FloatType <SELF, FLOAT, A, PRED> x, SELF y)
     where FLOAT : struct, Floating <A>
     where PRED : struct, Pred <A>
     where SELF : FloatType <SELF, FLOAT, A, PRED> =>
 from a in x
 from b in y
 select default(FLOAT).Subtract(a, b);
Beispiel #2
0
 static A ValueOrDefault(FloatType <SELF, FLOATING, A, PRED> floatType) =>
 ReferenceEquals(floatType, null)
         ? default(FLOATING).Empty()
         : floatType.Value;
Beispiel #3
0
 public static SELF map <SELF, FLOAT, T, PRED>(FloatType <SELF, FLOAT, T, PRED> value, Func <T, T> map)
     where FLOAT : struct, Floating <T>
     where PRED : struct, Pred <T>
     where SELF : FloatType <SELF, FLOAT, T, PRED> =>
 value.Map(map);
Beispiel #4
0
 public static S fold <SELF, FLOAT, T, S, PRED>(FloatType <SELF, FLOAT, T, PRED> value, S state, Func <S, T, S> folder)
     where FLOAT : struct, Floating <T>
     where PRED : struct, Pred <T>
     where SELF : FloatType <SELF, FLOAT, T, PRED> =>
 value.Fold(state, folder);
Beispiel #5
0
 public static int count <SELF, FLOAT, T, PRED>(FloatType <SELF, FLOAT, T, PRED> value)
     where FLOAT : struct, Floating <T>
     where PRED : struct, Pred <T>
     where SELF : FloatType <SELF, FLOAT, T, PRED> =>
 1;
Beispiel #6
0
 public static bool forall <SELF, FLOAT, T, PRED>(FloatType <SELF, FLOAT, T, PRED> value, Func <T, bool> predicate)
     where FLOAT : struct, Floating <T>
     where PRED : struct, Pred <T>
     where SELF : FloatType <SELF, FLOAT, T, PRED> =>
 predicate((T)value);
Beispiel #7
0
 public static Unit iter <SELF, FLOAT, T, PRED>(FloatType <SELF, FLOAT, T, PRED> value, Action <T> f)
     where FLOAT : struct, Floating <T>
     where PRED : struct, Pred <T>
     where SELF : FloatType <SELF, FLOAT, T, PRED> =>
 value.Iter(f);
Beispiel #8
0
 public static SELF divide <SELF, FLOAT, A>(FloatType <SELF, FLOAT, A> x, SELF y)
     where FLOAT : struct, Floating <A>
     where SELF : FloatType <SELF, FLOAT, A> =>
 from a in x
 from b in y
 select default(FLOAT).Divide(a, b);
Beispiel #9
0
 public static bool exists <SELF, FLOAT, T>(FloatType <SELF, FLOAT, T> value, Func <T, bool> predicate)
     where FLOAT : struct, Floating <T>
     where SELF : FloatType <SELF, FLOAT, T> =>
 predicate((T)value);
Beispiel #10
0
 public static int count <SELF, FLOAT, T>(FloatType <SELF, FLOAT, T> value)
     where FLOAT : struct, Floating <T>
     where SELF : FloatType <SELF, FLOAT, T> =>
 1;
Beispiel #11
0
 public static SELF bind <SELF, FLOAT, T>(FloatType <SELF, FLOAT, T> value, Func <T, SELF> bind)
     where FLOAT : struct, Floating <T>
     where SELF : FloatType <SELF, FLOAT, T> =>
 value.Bind(bind);
Beispiel #12
0
 public static A sum <SELF, FLOAT, A, PRED>(FloatType <SELF, FLOAT, A, PRED> self)
     where SELF : FloatType <SELF, FLOAT, A, PRED>
     where PRED : struct, Pred <A>
     where FLOAT : struct, Floating <A> =>
 (A)self;
Beispiel #13
0
 public static SELF Sum <SELF, FLOATING, A>(this IEnumerable <FloatType <SELF, FLOATING, A> > self)
     where FLOATING : struct, Floating <A>
     where SELF : FloatType <SELF, FLOATING, A> =>
 self.Fold(FloatType <SELF, FLOATING, A> .FromInteger(0), (s, x) => s + x);