Generator for comparing 'simple' lists when they are encountered.  This
    does not currently recurse further.  Arguments are as per other
    ``compare_``\ *X* functions.

def compare_list_iter(propval_a, propval_b, fs_a=None, fs_b=None,
                      options=None):
    """Generator for comparing 'simple' lists when they are encountered.  This
    does not currently recurse further.  Arguments are as per other
    ``compare_``\ *X* functions.
    """
    if fs_a is None:
        fs_a = FieldSelector(tuple())
        fs_b = FieldSelector(tuple())
    if not options:
        options = DiffOptions()
    propvals = dict(a=propval_a, b=propval_b)
    values = dict()
    indices = dict()
    for x in "a", "b":
        propval_x = propvals[x]
        vals = values[x] = set()
        rev_key = indices[x] = dict()
        seen = collections.Counter()
        for i, v in collection_generator(propval_x):
            v = options.normalize_item(
                v, propval_a if options.duck_type else propval_x
            )
            if not v.__hash__:
                v = repr(v)
            if v is not _nothing or not options.ignore_empty_slots:
                vals.add((v, seen[v]))
                rev_key[(v, seen[v])] = i
                seen[v] += 1

    removed = values['a'] - values['b']
    added = values['b'] - values['a']

    if options.unchanged or options.moved:
        unchanged = values['a'] & values['b']
        for v, seq in unchanged:
            a_idx = indices['a'][v, seq]
            b_idx = indices['b'][v, seq]
            if options.moved and a_idx != b_idx:
                yield DiffInfo(
                    diff_type=DiffTypes.MOVED,
                    base=fs_a + [a_idx],
                    other=fs_b + [b_idx],
                )
            elif options.unchanged:
                yield DiffInfo(
                    diff_type=DiffTypes.NO_CHANGE,
                    base=fs_a + [a_idx],
                    other=fs_b + [b_idx],
                )

    removed_idx = set(indices['a'][v, seq] for v, seq in removed)
    added_idx = set(indices['b'][v, seq] for v, seq in added)
    modified_idx = set(removed_idx.intersection(added_idx))

    for v, seq in removed:
        a_key = indices['a'][v, seq]
        if a_key in modified_idx:
            continue
        selector = fs_a + [a_key]
        yield DiffInfo(
            diff_type=DiffTypes.REMOVED,
            base=selector,
            other=fs_b,
        )

    for v, seq in added:
        b_key = indices['b'][v, seq]
        if b_key in modified_idx:
            continue
        selector = fs_b + [b_key]
        yield DiffInfo(
            diff_type=DiffTypes.ADDED,
            base=fs_a,
            other=selector,
        )

    for idx in modified_idx:
        yield DiffInfo(
            diff_type=DiffTypes.MODIFIED,
            base=fs_a + [idx],
            other=fs_b + [idx],
        )