Can you do it if you just want to count the words in a string, for example how many "gastro" in "gastro gastro"? When you have that working you can use a broadcasting with that function over the array.
What do you call “more efficient memory handling”?
I think that in Julia, fusing the dots, this is, calling broadcasted function over the result of broadcasted function may eliminate intermediary data structures, however, a loop may do the same, depending on how it is written.
Nope, it’s not like Python in that regard. The reason vectorization is fast in Python isn’t memory handling, but that the calculation is handed off to a library written in a fast language like C, that just does looping.
In Julia, Julia itself is that fast language (except for some special cases like BLAS, which isn’t yet implemented in Julia because of the workload that would be).
The thing you think of as ‘fast vectorization’ is in most cases just looping under the hood in a faster language.
In fact, memory handling for vectorized code in ‘slow’ languages like Python and Matlab is normally quite bad, because you chain together vectorized operations that each produce intermediate temporary arrays. This can be avoided in Julia, either with “fused broadcasting” or with plain loops.