binary function that accepts left side key and left side value
trinary function that accepts left side key, left side value, and right side value
binary function that accepts right side key and right side value
import mir.ndslice; auto a = [1, 2, 3, 9].sliced.series(iota!int([4], 1)); auto b = [0, 2, 4, 9].sliced.series(iota!int([4], 1) * 10.0); alias unionAlgorithm = troykaSeries!( (key, left) => left, (key, left, right) => left + right, (key, right) => -right, ); auto c = unionAlgorithm(a, b); assert(c.index == [0, 1, 2, 3, 4, 9]); assert(c.data == [-10, 1, 22, 3, -30, 44]);
Constructs union using three functions to handle each intersection case separately.