Why can I manually splat Strings inside the Vector comprehension, but not so programatically? The error message indicates the lack of a call, but in the manual example, calls were lacking too.
How can I accomplish what was done manually, in a program?
When you write [ "Ab"..., "Cd"... ] that’s syntax sugar for a call to the vect function. You can check this by executing Meta.@lower [ "Ab"..., "Cd"... ]. The two arguments are splatted in this call.
When you write [ 2i for i in src ] the 2i is not the argument of a function, it’s the body of the anonymous function to call for each i, so you can’t splat in that context.
For the case at hand you can do vcat(collect.(src)...), or probably more efficient: collect(Iterators.flatten(src)).
This is neat because it uses a comprehension, thus aligning with the original post. It also illustrates a flattening mechanism without using a function!