title: Copy or clone a collection in Julia
body: <p>I have created a one-dimensional array(vector) in Julia, namely, <code>a=[1, 2, 3, 4, 5]</code>. Then I want to create a new vector <code>b</code>, where <code>b</code> has exactly same elements in <code>a</code>, i.e <code>b=[1, 2, 3, 4, 5]</code>. </p>
  
  <p>It seems that directly use <code>b = a</code> just create a pointer for the original collection, which means if I modify <code>b</code> and <code>a</code> is mutable, the modification will also be reflected in <code>a</code>. For example, if I use <code>!pop(b)</code>, then <code>b=[1, 2, 3, 4]</code> and <code>a=[1, 2, 3, 4]</code>. </p>
  
  <p>I am wondering if there is a official function to merely copy or clone the collection, which the change in <code>b</code> will not happen in <code>a</code>. I find a solution is use <code>b = collect(a)</code>. I would appreciate that someone provide some other approaches.</p>