Trait differential_dataflow::operators::iterate::Iterate[][src]

pub trait Iterate<G: Scope, D: Data, R: Semigroup> {
    fn iterate<F>(&self, logic: F) -> Collection<G, D, R>
    where
        G::Timestamp: Lattice,
        F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>
; }

An extension trait for the iterate method.

Required methods

fn iterate<F>(&self, logic: F) -> Collection<G, D, R> where
    G::Timestamp: Lattice,
    F: FnOnce(&Collection<Iterative<'a, G, u64>, D, R>) -> Collection<Iterative<'a, G, u64>, D, R>, 
[src]

Iteratively apply logic to the source collection until convergence.

Importantly, this method does not automatically consolidate results. It may be important to conclude with consolidate() to ensure that logically empty collections that contain cancelling records do not result in non-termination. Operators like group, distinct, and count also perform consolidation, and are safe to conclude with.

Examples

extern crate timely;
extern crate differential_dataflow;

use differential_dataflow::input::Input;
use differential_dataflow::operators::Iterate;
use differential_dataflow::operators::Consolidate;

fn main() {
    ::timely::example(|scope| {

        scope.new_collection_from(1 .. 10u32).1
             .iterate(|values| {
                 values.map(|x| if x % 2 == 0 { x/2 } else { x })
                       .consolidate()
             });
    });
}
Loading content...

Implementors

impl<G: Scope, D: Ord + Data + Debug, R: Abelian> Iterate<G, D, R> for Collection<G, D, R>[src]

impl<G: Scope, D: Ord + Data + Debug, R: Semigroup> Iterate<G, D, R> for G[src]

Loading content...