Redmine/6553: Fix implicit looping over multiple lists

Pull request for initial review of the changes to the code. Planning to add more test coverage to the acceptance test before merging.
NullIterators uses internal detail of PromiseIterator struct, hence the implementation belongs into iterator.c.

The function has already been declared in iterator.h, but was never implemented, from what I see.