Trait differential_dataflow::operators::iterate::Iterate
[−]
[src]
pub trait Iterate<G: Scope, D: Data, R: Diff> { fn iterate<F>(&self, logic: F) -> Collection<G, D, R>
where
G::Timestamp: Lattice,
F: FnOnce(&Collection<Child<'a, G, u64>, D, R>) -> Collection<Child<'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<Child<'a, G, u64>, D, R>) -> Collection<Child<'a, G, u64>, D, R>,
G::Timestamp: Lattice,
F: FnOnce(&Collection<Child<'a, G, u64>, D, R>) -> Collection<Child<'a, G, u64>, D, R>,
Iteratively apply logic
to the source collection until convergence.
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() }); }); }