Mutable scan for efficient in-place updates
Closed this issue · 1 comments
milibopp commented
The current signature of Stream::scan
goes roughly like this:
pub fn scan<B, F: Fn(B, A) -> B>(&self, initial: B, f: F) -> Signal<B>;
An alternative would be to allow something like this additionally:
pub fn scan_mut<B, F: Fn(&mut B, A)>(&self, initial: B, f: F) -> Signal<B>;
The obvious advantage is the abstraction of efficient in-place operations, which are not possible at the moment (without depending on implementation details). It's probably be a good idea to address this along with #26.
A practical example of a project that would benefit from that is PistonDevelopers/conrod#400. Generally speaking it allows imperative APIs to be used in conjunction with carboxyl.