Locally finite sorted-stream merge

ID: locally-finite-sorted-stream-merge

Compare the heads of two increasing lazy lists, emit the smaller and advance its input, or emit one copy and advance both when the heads are equal. This preserves strict order and removes duplicates. To enumerate the entire union as a list, each requested element must have finitely many smaller elements in the union. Without this condition, an increasing sequence tending to one can permanently precede an input element equal to two. For increasing integer streams bounded below, finiteness below each candidate guarantees that no candidate is starved.

New to topics? Read the docs here!