예제 #1
0
        public static Aff <RT, Lst <B> > TraverseParallel <RT, A, B>(this Lst <Aff <RT, A> > ma, Func <A, B> f, int windowSize)
            where RT : struct, HasCancel <RT> =>
        AffMaybe <RT, Lst <B> >(async env =>
        {
            var rs = await ma.AsEnumerable().Map(m => m.Run(env)).WindowMap(windowSize, fa => fa.Map(f));

            var(fails, succs) = rs.Partition();
            return(fails.Any()
                    ? FinFail <Lst <B> >(fails.Head())
                    : FinSucc <Lst <B> >(toList(succs)));
        });
예제 #2
0
        public static Aff <Lst <B> > TraverseParallel <A, B>(this Lst <Aff <A> > ma, Func <A, B> f, int windowSize) =>
        AffMaybe <Lst <B> >(async() =>
        {
            var rs = await ma.AsEnumerable().Map(m => m.Run()).WindowMap(windowSize, fa => fa.Map(f)).ConfigureAwait(false);

            var(fails, succs) = rs.Partition();
            var fails1        = fails.Take(1).ToArray();

            return(fails1.Length == 1
                           ? FinFail <Lst <B> >(fails1[0])
                           : FinSucc <Lst <B> >(toList(succs)));
        });
예제 #3
0
 public Lst <T> Divide(Lst <T> rhs) =>
 (from y in rhs.AsEnumerable()
  from x in this.AsEnumerable()
  select TypeDesc.Divide(x, y, TypeDesc <T> .Default)).Freeze();
예제 #4
0
 public static Lst <PredList, B> Select <PredList, A, B>(this Lst <PredList, A> self, Func <A, B> map)
     where PredList : struct, Pred <ListInfo> =>
 new Lst <PredList, B>(self.AsEnumerable().Select(map));
예제 #5
0
 public static Lst <B> Select <A, B>(this Lst <A> self, Func <A, B> map) =>
 new Lst <B>(self.AsEnumerable().Select(map));