Exemplo n.º 1
0
 public static NUMTYPE append <NUMTYPE, NUM, A, PRED>(NumType <NUMTYPE, NUM, A, PRED> x, NumType <NUMTYPE, NUM, A, PRED> y)
     where NUMTYPE : NumType <NUMTYPE, NUM, A, PRED>
     where PRED    : struct, Pred <A>
     where NUM     : struct, Num <A> =>
 from a in x
 from b in y
 select default(NUM).Append(a, b);
Exemplo n.º 2
0
 public static NUMTYPE subtract <NUMTYPE, NUM, A, PRED>(NumType <NUMTYPE, NUM, A, PRED> x, NUMTYPE y)
     where NUM     : struct, Num <A>
     where PRED    : struct, Pred <A>
     where NUMTYPE : NumType <NUMTYPE, NUM, A, PRED> =>
 from a in x
 from b in y
 select default(NUM).Subtract(a, b);
Exemplo n.º 3
0
 public static NUMTYPE map <NUMTYPE, NUM, T, PRED>(NumType <NUMTYPE, NUM, T, PRED> value, Func <T, T> map)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 value.Map(map);
Exemplo n.º 4
0
 public static bool forall <NUMTYPE, NUM, T, PRED>(NumType <NUMTYPE, NUM, T, PRED> value, Func <T, bool> predicate)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 predicate((T)value);
Exemplo n.º 5
0
 public static int count <NUMTYPE, NUM, T, PRED>(NumType <NUMTYPE, NUM, T, PRED> value)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 1;
Exemplo n.º 6
0
 public static A sum <NUMTYPE, NUM, A>(NumType <NUMTYPE, NUM, A> self)
     where NUMTYPE : NumType <NUMTYPE, NUM, A>
     where NUM     : struct, Num <A> =>
 (A)self;
Exemplo n.º 7
0
 public static NUMTYPE divide <NUMTYPE, NUM, A>(NumType <NUMTYPE, NUM, A> x, NUMTYPE y)
     where NUM     : struct, Num <A>
     where NUMTYPE : NumType <NUMTYPE, NUM, A> =>
 from a in x
 from b in y
 select default(NUM).Divide(a, b);
Exemplo n.º 8
0
 public static Unit iter <NUMTYPE, NUM, T, PRED>(NumType <NUMTYPE, NUM, T, PRED> value, Action <T> f)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 value.Iter(f);
Exemplo n.º 9
0
 public static int count <NUMTYPE, NUM, T>(NumType <NUMTYPE, NUM, T> value)
     where NUM : struct, Num <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T> =>
 1;
Exemplo n.º 10
0
 public static Unit iter <NUMTYPE, NUM, T>(NumType <NUMTYPE, NUM, T> value, Action <T> f)
     where NUM : struct, Num <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T> =>
 value.Iter(f);
Exemplo n.º 11
0
 public static NUMTYPE bind <NUMTYPE, NUM, T>(NumType <NUMTYPE, NUM, T> value, Func <T, NUMTYPE> bind)
     where NUM : struct, Num <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T> =>
 value.Bind(bind);
Exemplo n.º 12
0
 public static A sum <NUMTYPE, NUM, A, PRED>(NumType <NUMTYPE, NUM, A, PRED> self)
     where NUMTYPE : NumType <NUMTYPE, NUM, A, PRED>
     where PRED : struct, Pred <A>
     where NUM     : struct, Num <A> =>
 (A)self;
Exemplo n.º 13
0
 public static NUMTYPE bind <NUMTYPE, NUM, T, PRED>(NumType <NUMTYPE, NUM, T, PRED> value, Func <T, NUMTYPE> bind)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 value.Bind(bind);
Exemplo n.º 14
0
 public static int compare <NEWTYPE, NUM, T, PRED>(NEWTYPE x, NumType <NEWTYPE, NUM, T, PRED> y)
     where NUM : struct, Num <T>
     where PRED : struct, Pred <T>
     where NEWTYPE : NumType <NEWTYPE, NUM, T, PRED> =>
 OrdNumType <NEWTYPE, NUM, T, PRED> .Inst.Compare(x, y);
Exemplo n.º 15
0
 static A ValueOrDefault(NumType <SELF, NUM, A, PRED> numType) =>
 ReferenceEquals(numType, null)
         ? default(NUM).Empty()
         : numType.Value;
Exemplo n.º 16
0
 public static S fold <NUMTYPE, NUM, T, S, PRED>(NumType <NUMTYPE, NUM, T, PRED> value, S state, Func <S, T, S> folder)
     where NUM     : struct, Num <T>
     where PRED    : struct, Pred <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T, PRED> =>
 value.Fold(state, folder);
Exemplo n.º 17
0
 public static bool exists <NUMTYPE, NUM, T>(NumType <NUMTYPE, NUM, T> value, Func <T, bool> predicate)
     where NUM : struct, Num <T>
     where NUMTYPE : NumType <NUMTYPE, NUM, T> =>
 predicate((T)value);
Exemplo n.º 18
0
 public static SELF Sum<SELF, NUM, A>(this IEnumerable<NumType<SELF, NUM, A>> self)
     where SELF : NumType<SELF, NUM, A>
     where NUM : struct, Num<A> =>
     self.Fold(NumType<SELF, NUM, A>.FromInteger(0), (s, x) => s + x);