title: Duplicate Elements in Array (SML)
body: <p>I have the following list</p>
  
  <pre><code>L = [2, 4, 6, 8, 10]
  </code></pre>
  
  <p>and I am trying to write a function that duplicates each element in the list, so the end result would be</p>
  
  <pre><code>L = [2, 2, 4, 4, 6, 6, 10, 10]
  </code></pre>
  
  <p>where my function is </p>
  
  <pre><code>fun duplicateList(nil) = nil
    | duplicateList([a]) = [a]
    | duplicateList(L) = 
         let val copy = L
         in hd(L)::hd(copy)::duplicateList(tl(L))
         end;
  </code></pre>
  
  <p>But I keep getting an error that reads <code>Error: syntax error: replacing END with EQUALOP</code></p>
  
  <p>What does that mean and how can I avoid it?</p>