title: mapply multiple undefined arguments
body: <p>Assume you have an undefined nr of lists as possible arguments for a function, for example the following 3 can be picked (this example is as simple as possible, so vectors are stored in lists):</p>
  
  <pre><code>a &lt;- list(c(1,2,3,4,5))
  b &lt;- list(c(3,6,7,2,1))
  c &lt;- list(c(3,9,8))
  </code></pre>
  
  <p>If I want to calculate the intersection of all three lists, this can be done as follows:</p>
  
  <pre><code>Map(intersect,c,Map(intersect,a,b))
  # or equivalent:
  mapply(intersect,c,mapply(intersect,a,b,SIMPLIFY=F))
  # [1] 3
  </code></pre>
  
  <p>But how can I change the nr of arguments to be undefined? I read about <code>...</code>, but I cannot get it to work. First idea was to write a function, that can have multiple list arguments defined by <code>...</code>:</p>
  
  <pre><code>intersectio &lt;- function(...){
    Map(function(...){
      intersect(...)
    })
  }
  </code></pre>
  
  <p>Q: But that doesn't work of course, because intersect must be applied recursively. Is there any way to achieve this in R?</p>
  
  <p>Q2: Here is an updated example with a nested list structure. How can it be done in this case, i.e. intersect every sublist of the parent list with the associated sublist (same index) of the other parent lists?</p>
  
  <pre><code>a &lt;- list(list(c(1,2,3,4,5)),list(c(3,6,7,2,1)),list(c(3,9,8)))
  b &lt;- list(list(c(1,2)),list(c(3,6,9,11,12)),list(c(3)))
  c &lt;- list(list(c(1,9)),list(c(65,23,12)),list(c(14,15)))
  </code></pre>