예제 #1
0
 /// <summary>
 /// Folds the contained elements using required aspects of a supplied
 /// monoid
 /// </summary>
 /// <param name="m">The monoid providing the required combiner</param>
 /// <param name="container">The structure to be folded/aggregated</param>
 /// <returns></returns>
 public X fold(IMonoid <X> m, CX container)
 => Seq.foldr(m.combine, m.zero, Seq.make(container.Stream()));
예제 #2
0
 /// <summary>
 /// Implements a right-fold over the container
 /// </summary>
 /// <typeparam name="Y">The type of the accumulated value</typeparam>
 /// <param name="f">The accumulator</param>
 /// <param name="y0">The seed value</param>
 /// <param name="container"></param>
 /// <returns></returns>
 public Y foldr <Y>(Func <X, Y, Y> f, Y y0, CX container)
 => Seq.foldr(f, y0, Seq.make(container.Stream()));
예제 #3
0
파일: Seq.inst.cs 프로젝트: 0xCM/Meta.Core
 public Y foldr <Y>(Func <X, Y, Y> f, Y y0, Seq <X> s)
 => Seq.foldr(f, y0, s);