title: Indexing a list with an empty index
body: <p>The technique of indexing a data frame with an empty index features several times in Hadley Wickam's <a href="http://adv-r.had.co.nz/">Advanced R</a>, but is only explained there in passing. I'm trying to figure out the rules governing indexing a list with an empty index. Consider the following four statements.</p>
  
  <pre><code>&gt; (l &lt;- list(a = 1, b = 2))
  $a
  [1] 1
  
  $b
  [1] 2
  
  &gt; (l[] &lt;- list(c = 3))
  $c
  [1] 3
  
  &gt; l
  $a
  [1] 3
  
  $b
  [1] 3
  
  &gt; l[]
  $a
  [1] 3
  
  $b
  [1] 3
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>Why is the output from second statement different from the output from the third statement? Isn't assignment supposed to return the object being assigned to, in which case the second statement should yield the same output as the third one?</li>
  <li>How come did the assignment in the second statement result in the output shown after the third statement? What are the rules governing assignment to an emptily indexed list?</li>
  <li>How come did the fourth statement yield the output shown? What are the rules governing indexing a list with an empty index when it is not on the left hand side of an assignment?</li>
  </ol>