Yes, that would be better written to pre-extend the array only once. Another good PR/issue to open.
On Wed, Mar 16, 2016 at 10:58 PM, Cedric St-Jean <[email protected]> wrote: > Not part of Michele's PR, but I just saw this definition: > > push!(A, a, b, c...) = push!(push!(A, a, b), c...) > > Doesn't it make the vector reallocate+copy many times instead of just once? > > On Wednesday, March 16, 2016 at 9:45:02 AM UTC-4, Stefan Karpinski wrote: >> >> Yes, wonderful! Thanks for contributing it. If you add a test, it'll get >> merged rapidamente. >> >> On Wed, Mar 16, 2016 at 4:03 AM, Michele Zaffalon <[email protected]> >> wrote: >> >>> Something like this <https://github.com/JuliaLang/julia/pull/15529>? >>> >>> On Tue, Mar 15, 2016 at 7:28 PM, Stefan Karpinski <[email protected]> >>> wrote: >>> >>>> It's just an absent feature – if you'd open an issue, I'm sure someone >>>> will add it shortly. It would make a pretty good intro issue. >>>> >>>> On Tue, Mar 15, 2016 at 12:43 PM, Michele Zaffalon < >>>> [email protected]> wrote: >>>> >>>>> I have some arrays I would like to `append!` to the first. At the >>>>> moment I do >>>>> >>>>> reduce(append!, array_1, [array_2, array_3, ...]), >>>>> >>>>> but I would like to write >>>>> >>>>> append!(array_1, array_2, array_3, ...) >>>>> >>>>> just like for `push!`ing several items into the collection. Why is >>>>> this not allowed? >>>>> >>>>> Thank you, >>>>> michele >>>>> >>>>> >>>>> >>>> >>> >>
