SetSymmetricDifference / List Layer
Compute the symmetric difference between two variable-length lists. Returns a list containing elements that exist in either list but not in both. Similar to Python's symmetric_difference() or XOR operation for sets.
Mathematical definition: For sets A and B, the symmetric difference A △ B is defined as: Or equivalently:
Example transformation:
left_list | right_list | sym_difference |
---|---|---|
[1, 2, 3] | [2, 3, 4] | [1, 4] |
[a, b, c] | [b, d] | [a, c, d] |
[1, 1, 2] | [2, 2, 3] | [1, 3] |
[x, y] | [] | [x, y] |
[] | [1, 2] | [1, 2] |
[1, null, 3] | [1, 2] | [2, 3] |
Properties:
- Commutative:
- Associative:
- Identity:
- Self-inverse:
Common applications:
- Finding changes between versions
- Detecting mutual exclusions
- Identifying discrepancies
- Finding unique elements across sets
- Analyzing version differences
- Computing XOR-like operations
Note: Duplicates in input lists are removed (set semantics). Null values are ignored. Order of elements in result is not guaranteed. Lists can have different lengths.
SelectLeft
columnThe first list column (SelectLeft
) for symmetric difference. Examples:
- Version 1 features: [f1, f2, f3]
- User A permissions: [read, write]
- Original tags: [urgent, important] Lists can have different lengths. Duplicates allowed but treated as single elements.
SelectRight
columnThe second list column (SelectRight
) for symmetric difference. Examples:
- Version 2 features: [f2, f3, f4]
- User B permissions: [read, admin]
- Updated tags: [important, critical] Lists can have different lengths. Duplicates allowed but treated as single elements.
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.