ListBinaryOps (Yogurt Nodes)
One node for union, intersection, zips, and every other two-list trick
- list_a
- list_b
- fill_value
- result
- count
Lists are the workhorse data type of any batch workflow, and once you have two of them you immediately want to combine them - merge, dedupe, find what's in both, pair them up. ListBinaryOps is the kitchen drawer that holds all of it: twenty-one binary operations on two lists behind a single dropdown, from union and intersection to zip, splice, swap_ranges, and even elementwise math.
It's a logic node in the YogurtNodes pack (yogurt7771/ComfyUI-YogurtNodes), and it's the node that saves you from installing a different list-utility pack just to get one set operation.
How it works
Two required inputs, list_a and list_b (any list-like thing - it coerces iterables to lists), plus an operation dropdown. The results:
- Set ops:
union(deduped merge),intersection,difference,symmetric_difference, plus_uniqueand_sortedvariants. These preserve order and handle duplicates sensibly -intersectioncounts occurrences,intersection_uniquedoesn't. - Zip family:
zip(pairs up, truncating),zip_longest(pads withfill_value),zip_repeat(cycles the shorter list), andzip_concat/zip_longest_concatwhich join each pair into a string with yourconcatconnector - great for building"prompt:strength"style strings from parallel lists. - Structural:
cartesian_product,interleave(weave two lists),splice(replace a slice of A with B usingstart_index/end_index),swap_ranges(swap a slice of A with a slice of B), andmerge_dicts/merge_with_keyfor when your lists are dicts. - Math:
elementwise_add/sub/mul- because[1,2,3] + [4,5,6]being concatenation in Python and you wanting it added elementwise is exactly the kind of thing a node graph makes clear.
Every operation returns result and count (the length), so you get the length for free - no separate size node needed.
Inputs that matter
operation- the dropdown. Start with the set ops; explore the rest when a workflow needs them.list_a,list_b- the two inputs.fill_value- needed forzip_longestandinterleavepadding.concat- the connector forzip_concatvariants.start_index/end_index/other_start_index/range_length- only used byspliceandswap_ranges.
Install
Pack-wide routine - ComfyUI Manager (search "YogurtNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart, find it under Yogurt Nodes / Logic. No extra dependencies.
Troubleshooting
- "union is dropping my duplicates." That's not a bug - union is dedupe-by-design. If you want concatenation-with-duplicates, that's ListConcat's job, not union's.
- "My lists aren't sortable."
union_sortedneeds comparable elements; mixed types (numbers + strings) throw. Use plainunioninstead. splicewithend_index = -1inserts rather than replaces - that's documented behavior, but it surprises people the first time. Andrange_length = -1onswap_rangesauto-matches the shared space, so you don't have to count manually.- A wrong operation silently does the wrong thing. The dropdown is all power. If output looks sane but wrong, double-check you didn't pick
differencewhen you wantedsymmetric_difference- the names are close, the results are not.
The honest review: you won't use all twenty-one ops. But the set operations and the zip variants are genuinely useful, and having them in one node beats a drawer of single-purpose list utilities. It's the list node I'd reach for before installing another pack.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| operation | COMBO | union | Binary operation to apply to the two inputs. |
| list_a | * | First list-like input. | |
| list_b | * | Second list-like input. | |
| fill_valueopt | * | Padding value for zip_longest variants and interleave. | |
| concatopt | STRING | Connector inserted between paired elements for concat variants. | |
| keyopt | STRING | Dictionary key used by merge_with_key. | |
| start_indexopt | INT | 0-2147483648–2147483647 | Start index used by splice and swap_ranges. |
| end_indexopt | INT | -1-2147483648–2147483647 | Exclusive end index for splice. Use -1 to insert only. |
| other_start_indexopt | INT | 0-2147483648–2147483647 | Start index in list_b for swap_ranges. |
| range_lengthopt | INT | -1-1–2147483647 | Range length for swap_ranges. -1 auto-matches shared space. |
| sort_reverseopt | BOOLEAN | false | Reverse sorting for union_sorted. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result | * | — |
| count | INT | — |