All possible combinations of elements from different bins (one element from every bin) : <p>I have a list, where each element is a set of numbers. Lengths of all sets are different:</p>

<pre><code> a &lt;- list(1,c(2,3),c(4,5,6))
#&gt; a
#[[1]]
#[1] 1

#[[2]]
#[1] 2 3

#[[3]]
#[1] 4 5 6 
</code></pre>

<p>I'd like to get all possible combinations of one element from each set. In this example it should be:</p>

<p>1 2 4, 1 2 5, 1 2 6, 1 3 4, 1 3 5, 1 3 6</p>

<p>I feel that some combination of *apply-functions here would be useful, but can't figure out how to do that.</p>
