In Python, given a list a=[1,2]
, I can extend it with
a.extend([3,4])
Now a contains [1,2,3,4]
. Does Julia have a simple way to extend vectors? Of course, vcat
comes to mind:
a = [1,2]
a = vcat(a,[3,4])
Are there better approaches?
In Python, given a list a=[1,2]
, I can extend it with
a.extend([3,4])
Now a contains [1,2,3,4]
. Does Julia have a simple way to extend vectors? Of course, vcat
comes to mind:
a = [1,2]
a = vcat(a,[3,4])
Are there better approaches?
Yes, many. See push!
, pushfirst!
, append!
for starters.