From b415029a6a75680bd967043030a915b08d36d23a Mon Sep 17 00:00:00 2001 From: David Spies Date: Tue, 10 Nov 2020 08:03:55 -0800 Subject: [PATCH 1/2] Function for concatenating rather than replacing --- src/operators/iterate.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/operators/iterate.rs b/src/operators/iterate.rs index f1e549ce0..af82bbc75 100644 --- a/src/operators/iterate.rs +++ b/src/operators/iterate.rs @@ -188,12 +188,17 @@ impl Variable where G::Timestamp: Lattic /// Adds a new source of data to the `Variable`. pub fn set(self, result: &Collection) -> Collection { + let in_result = self.source.negate().concat(result); + self.set_concat(&in_result) + } + + + /// Concat a new source of data to the data already in the `Variable`. + pub fn set_concat(self, result: &Collection) -> Collection { let step = self.step; - self.source - .negate() - .concat(result) + result .inner - .flat_map(move |(x,t,d)| step.results_in(&t).map(|t| (x,t,d))) + .flat_map(move |(x, t, d)| step.results_in(&t).map(|t| (x, t, d))) .connect_loop(self.feedback); self.collection @@ -276,4 +281,4 @@ impl Deref for SemigroupVariable where fn deref(&self) -> &Self::Target { &self.collection } -} \ No newline at end of file +} From 3f42caea97191f23ca665f824162ccf6937e5637 Mon Sep 17 00:00:00 2001 From: David Spies Date: Wed, 18 Nov 2020 08:56:44 -0800 Subject: [PATCH 2/2] Remove accidental whitespace change --- src/operators/iterate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operators/iterate.rs b/src/operators/iterate.rs index af82bbc75..b0d03fc74 100644 --- a/src/operators/iterate.rs +++ b/src/operators/iterate.rs @@ -198,7 +198,7 @@ impl Variable where G::Timestamp: Lattic let step = self.step; result .inner - .flat_map(move |(x, t, d)| step.results_in(&t).map(|t| (x, t, d))) + .flat_map(move |(x,t,d)| step.results_in(&t).map(|t| (x,t,d))) .connect_loop(self.feedback); self.collection