Just a little Thursday afternoon note about subtracting arrays that was discovered doing the hamming test, which detects the number of differences between two different DNA strands.
Let’s say you had to two DNA strands:
1 2 |
|
If you subtracted strand1
from strand2
, you’d expect the difference to be 1
, right? In fact, it is 1
.
Let’s take another example of another two DNA strands:
1 2 |
|
If you subtracted strand3
from strand4
, you’d expect the difference to be 1
, right? There is 1 letter different between the two strands.
However what you get is 0
.
It seems that the -
operator checks for uniques rather than checking in place.
Happy Thursday!