⎕S is an operator which takes the regex on its left and what to return for each match on its right. 3 is a special code meaning the pattern number, which is just 0 because we only have one regex.
Then we tally (count) that with ≢ and we're done.
@user654303 @AnandChitipothu Can you think of another approach to counting the words?
So if we think not in terms of the arguments, but in terms of the functions that are being applied to them, then we have ≠ applied between the arguments, and on the right we have just the right argument.
@lelf Yes, it has been fixed in 17.1 which the bot (=TIO) runs.
Instead of doing {+/2</⍺=⍵,⍺} we can do {+/2</(⍺=⍵),1}
Here we use the original text directly (without modification) to derive our Boolean mask, and then we simply add a single trailing bit in-place, as there are no other references to our newly created mask array.
sorry, what if out bitmask has not empty bit? If the number of characters is multiple of 8 then the bitmark will occupy all the bits in the bit mark and there won't be any free bits available to set it. Is my understanding correct?
@AnandChitipothu If it has no empty bit? No 0 bit you mean?
@Bubbler The reason is that the concatenation of a single bit to the end of the big mask can happen in-place, as we simply extend the memory pocket by a bit (7 times out of 8 doesn't even need a pocket extension), but putting a bit at the front requires copying the entire mask.