union for filters
Returns a list of unique elements from both the input and the provided list.
Signature
> union {flags} (other)
Parameters
other: The other list to union with.
Input/output types:
| input | output |
|---|---|
| list<any> | list<any> |
| table | table |
Examples
Return the union of two lists
> [1 2 3 4] | union [3 4 5 6]
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
│ 3 │ 4 │
│ 4 │ 5 │
│ 5 │ 6 │
╰───┴───╯Union with duplicates in input
> [1 1 2 3] | union [2 3 4]
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
│ 3 │ 4 │
╰───┴───╯Union of two tables (dedup rows)
> [{a:1} {a:2}] | union [{a:2} {a:3}]
╭───┬───╮
│ # │ a │
├───┼───┤
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
╰───┴───╯