inter
¶
Intersection of two lists or dictionaries
x inter y inter[x;y]
Where x
and y
are lists or dictionaries, uses the result of x in y
to return items or entries from x
.
q)1 3 4 2 inter 2 3 5 7 11
3 2
Returns common values from dictionaries.
q)show x:(`a`b)!(1 2 3;`x`y`z)
a| 1 2 3
b| x y z
q)show y:(`a`b`c)!(1 2 3;2 3 5;`x`y`z)
a| 1 2 3
b| 2 3 5
c| x y z
q)
q)x inter y
1 2 3
x y z
q)
Returns common rows from simple tables.
q)show x:([]a:`x`y`z`t;b:10 20 30 40)
a b
----
x 10
y 20
z 30
t 40
q)show y:([]a:`y`t`x;b:50 40 10)
a b
----
y 50
t 40
x 10
q)x inter y
a b
----
x 10
t 40