~ Match¶
x~y ~[x;y]
Returns 0b unless x and y are identical. Comparison tolerance is used when matching floats.
q)(1 2 3+4 5 6)~4 5 6+1 2 3 / the arguments are identical
1b
q)(1 2 3-4 5 6)~4 5 6-1 2 3 / these are not identical
0b
q)1 2 3 ~`a`b / any two data objects can be compared
0b
Match depends on the data type of the arguments, not just the values.
This means the same symbols from different enumerations do not match, even when equal.
Match ignores attributes on lists.
Two tables match even if they differ in attributes.
q)t1:([]x:1 2 3)
q)t2:([]x:`s#1 2 3)
q)meta t1
c| t f a
-| -----
x| j
q)meta t2
c| t f a
-| -----
x| j s
q)t1~t2
1b
Q for Mortals: §4.2 Match