I wrote an exclusive or operator for KDB after not appearing to find one. Here is what I wrote:
.q.xor:{((x&y)~:)&x|y}
Let's give some examples of how you can use it with both lists and scalars:
q) 00001111b xor 11110000b
11111111b
q) 1b xor 1b
0b
q) 1b xor 00001111b
11110000b
No comments:
Post a Comment