This is true, although it could still do better than pairwise vcat
, for instance by guessing that all are the same size as the first. Or by repeated doubling like append!
.
Indeed, this is one of the things which makes stack
easier.
Mostly nobody has got around to it. PR 31636 had a go. Another option would simply be to send this to reduce(vcat, map(f, xs))
, as this will usually be better. (This is also what happens for mapreduce(f, op, xs, ys)
at present.)
The other option would be to write a flatten
companion for stack
, since these clever reduce
overloads are hard to discover & quite fragile – it’s easy to step off the fast path, as with init keyword for example.