/// <summary>Applies a key-generating function to each element of a CloudFlow and return a CloudFlow yielding unique keys and the result of the threading an accumulator.</summary> /// <param name="projection">A function to transform items from the input CloudFlow to keys.</param> /// <param name="folder">A function that updates the state with each element from the CloudFlow.</param> /// <param name="combiner">A function that combines partial states into a new state.</param> /// <param name="state">A function that produces the initial state.</param> /// <param name="stream">The input CloudFlow.</param> /// <returns>The final result.</returns> public static CloudFlow <Tuple <TKey, TAccumulate> > AggregateBy <TSource, TKey, TAccumulate>(this CloudFlow <TSource> stream, Func <TSource, TKey> projection, Func <TAccumulate> state, Func <TAccumulate, TSource, TAccumulate> folder, Func <TAccumulate, TAccumulate, TAccumulate> combiner) { return(CSharpProxy.AggregateBy(stream, projection, state, folder, combiner)); }
/// <summary>Applies a state-updating function to a stream of inputs, grouped by key projection.</summary> /// <param name="projection">A function to transform items of the input stream into comparable keys.</param> /// <param name="folder">Folding function.</param> /// <param name="init">State initializing function.</param> /// <param name="source">The input stream.</param> /// <returns>A stream of tuples where each tuple contains the unique key and a sequence of all the elements that match the key.</returns> public static Stream<Tuple<TKey, TState>> AggregateBy<TSource, TKey, TState>(this Stream<TSource> source, Func<TSource,TKey> projection, Func<TState, TSource, TState> folder, Func<TState> init) { return CSharpProxy.AggregateBy(source, projection, folder, init); }
/// <summary>Applies a key-generating function to each element of a ParStream and return a ParStream yielding unique keys and the result of the threading an accumulator.</summary> /// <param name="projection">A function to transform items from the input ParStream to keys.</param> /// <param name="folder">A function that updates the state with each element from the ParStream.</param> /// <param name="state">A function that produces the initial state.</param> /// <param name="stream">The input ParStream.</param> /// <returns>The final result.</returns> public static ParStream <Tuple <TKey, TState> > AggregateBy <TSource, TKey, TState>(this ParStream <TSource> stream, Func <TSource, TKey> projection, Func <TState, TSource, TState> folder, Func <TState> state) { return(CSharpProxy.AggregateBy(stream, projection, folder, state)); }