Esempio n. 1
0
 public NonEmptyList <A> Append(NonEmptyList <A> x) =>
 IsEmpty ? x : new NonEmptyList <A>(UnsafeHead, UnsafeTail).Append(x);
Esempio n. 2
0
 public NonEmptyList <Pair <A, B> > Product <B>(NonEmptyList <B> o) =>
 ZipWith <B, Pair <A, B> >(o, Pair <A, B> .pairF());
Esempio n. 3
0
 public NonEmptyList <A> Append(NonEmptyList <A> x) => Append(x.List);
Esempio n. 4
0
 public static Pair <NonEmptyList <A>, NonEmptyList <B> > Unzip <A, B>(this NonEmptyList <Pair <A, B> > p) =>
 p.Tail.Get.Unzip().BinarySelect(ta => p.Head.Get._1.Get & ta, tb => p.Head.Get._2.Get & tb);
Esempio n. 5
0
 public NonEmptyList <C> ProductWith <B, C>(NonEmptyList <B> o, Func <A, Func <B, C> > f) =>
 SelectMany <C>(a => o.Select <C>(b => f(a)(b)));
Esempio n. 6
0
 public static NonEmptyList <B> ApplyZip <A, B>(this NonEmptyList <Func <A, B> > f, NonEmptyList <A> o) =>
 f.ZipWith <A, B>(o, a => b => a(b));
Esempio n. 7
0
 public static NonEmptyList <A> Flatten <A>(this NonEmptyList <NonEmptyList <A> > o) =>
 o.SelectMany(z => z);
Esempio n. 8
0
 public static NonEmptyList <C> SelectMany <A, B, C>(this NonEmptyList <A> ps, Func <A, NonEmptyList <B> > p, Func <A, B, C> f) =>
 SelectMany(ps, a => Select(p(a), b => f(a, b)));
Esempio n. 9
0
 public static NonEmptyList <B> Apply <A, B>(this NonEmptyList <Func <A, B> > f, NonEmptyList <A> o) =>
 f.ProductWith <A, B>(o, a => b => a(b));
Esempio n. 10
0
 public static NonEmptyList <B> Select <A, B>(this NonEmptyList <A> ps, Func <A, B> f) =>
 new NonEmptyList <B>(f(ps.Head.Get), ps.Tail.Get.Select(f));
Esempio n. 11
0
 public static NonEmptyList <B> SelectMany <A, B>(this NonEmptyList <A> ps, Func <A, NonEmptyList <B> > f) =>
 f(ps.Head.Get).Append(ps.Tail.Get.SelectMany(a => f(a).List));
Esempio n. 12
0
 public NonEmptyList <Pair <A, B> > Zip <B>(NonEmptyList <B> bs) => ZipWith <B, Pair <A, B> >(bs, a => b => a.And(b));
Esempio n. 13
0
 public NonEmptyList <C> ZipWith <B, C>(NonEmptyList <B> bs, Func <A, Func <B, C> > f) =>
 new NonEmptyList <C>(f(head)(bs.head), tail.ZipWith(bs.tail, f));
Esempio n. 14
0
 public NonEmptyList <A> Append(NonEmptyList <A> x)
 {
     return(IsEmpty ? x : new NonEmptyList <A>(UnsafeHead, UnsafeTail).Append(x));
 }
Esempio n. 15
0
 public NonEmptyList <A> Append(NonEmptyList <A> x)
 {
     return(Append(x.List));
 }
Esempio n. 16
0
 public static NonEmptyList <A> Flatten <A>(this NonEmptyList <NonEmptyList <A> > o)
 {
     return(o.SelectMany(z => z));
 }