Re:Aggregate streaming data in real-time with WebAssembly
by nielsbot on Tuesday August 24, 2021 @05:35PM
(#28295294)
I didn't know about "fold"... In Swift it's still call `reduce` even if your accumulator type is arbitrary:
https://developer.apple.com/documentation/swift/array/229868...
In Rusty pseudocode, reduce requires a function with two inputs and an output of the same type:
fn reduce<T>(f: Fn(T, T) -> T)
Whereas fold may use one type for the accumulator and another type for the elements, but requires an initial accumulator value to be given explicitly:
fn fold<A, T>(init: A, f: Fn(A, T) -> A)
The Aggregate SmartStreams discussed in the blog follow this fold pattern, applied to a distributed persistent log as the stream and using WebAssembly modules as the functions.