Returns a generator that compares two sorted iterables and yields tuples of corresponding elements. For matched elements, yields [lhs, rhs]. For elements only in lhs, yields [lhs, undefined]. For elements only in rhs, yields [undefined, rhs].
The type of left-hand side elements
The type of right-hand side elements
The right-hand side iterable (must be sorted)
The comparison function for comparing lhs and rhs elements (any negative/zero/positive result, e.g. a - b)
a - b
The direction of comparison (ascending by default)
Tuples of corresponding elements from both iterables
diff for a version that doesn't require presorted inputs
G.pipe( [1, 3, 5], G.sortedDiff([2, 3, 4], (a, b) => a - b), G.array) // [[1, undefined], [undefined, 2], [3, 3], [undefined, 4], [5, undefined]] Copy
G.pipe( [1, 3, 5], G.sortedDiff([2, 3, 4], (a, b) => a - b), G.array) // [[1, undefined], [undefined, 2], [3, 3], [undefined, 4], [5, undefined]]
Returns a generator that compares two sorted iterables and yields tuples of corresponding elements. For matched elements, yields [lhs, rhs]. For elements only in lhs, yields [lhs, undefined]. For elements only in rhs, yields [undefined, rhs].