In Information theory , the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of substitutions required to change one string into the other, or the minimum number of errors that could have transformed one string into the other.
Source : Wikipedia Hamming distance
In KDB, finding the hamming distance of two strings would be really trivial.
q)hammDist:{count where x=y} q)hammDist["karolin" ; "kathrin"] 3 q)hammDist[1011101b;1001001b] 2
K equivalent would be :
k)hammDist:{#&~x=y}
Though it would need some input checks like type check, string length comparison.
q)hammDist:{$[count[x]=count[y];count where (),xy;'`mismatch]} q) q)hammDist["k" ; "k"] 0 q)hammDist["k" ; "ks"] 'mismatch q)hammDist[1011101b;1001001b] 2