Exemplo n.º 1
0
        public static U Fold <T, U>(this Maybe <T> ts, U identity, Func <U, T, U> fn)
        {
            var accumulator = identity;

            foreach (T element in ts.AsEnumerable())
            {
                accumulator = fn(accumulator, element);
            }
            return(accumulator);
        }
Exemplo n.º 2
0
 public static void ForEach <A>(this Maybe <A> @this, Action <A> f) => @this.AsEnumerable().ForEach(f);