Hacker News new | ask | show | jobs
by chias 3919 days ago
> The result would be the characters that are in the first string but not in the second string

A result would be that, but I certainly would not call it the result.

Another result would be to treat the strings as byte arrays and subtract one byte from another, e.g. [a1,a2,a3] - [b1,b2,b3,b4] would result in [a1-b1, a2-b2, a3-b3, -b4]. I'm sure you could do any number of different "correct" operations. And then it's up to you, as a language designer, to decide what you think string-minus-string should actually do... and there is zero probability that everybody in the programming community will agree with your decision.