Convert a sample to an index We are putting balls into a fixed number a bins. These bins begin empty.
Empty bin (a=4): 0 0 0 0 

And one by one we add balls to the bins.
0 0 0 1  or
0 0 1 0  or
0 1 0 0  or
1 0 0 0

We need a quick way to loop over all the possible states the bins take, without duplicates and without missing any and we don't want to enumerate all the possible bins. So instead we assign each bin-configuration an index.
We assign the index by sorting the possible configurations in a specific way:

Sort ascending by sum: so first 0 0 0 0, then the possible configurations with 1 ball added, then 2, etc.

Then sort within each sum in ascending order, from the first bin to the last:
0 0 0 2
0 0 1 1
0 0 2 0 
0 1 0 1
0 1 1 0 
0 2 0 0 
etc


The index is then assigned ascending through this list:
0 0 0 0  -&gt; 1
0 0 0 1  -&gt; 2
0 0 1 0  -&gt; 3
0 1 0 0  -&gt; 4
1 0 0 0  -&gt; 5
0 0 0 2  -&gt; 6
0 0 1 1  -&gt; 7
0 0 2 0  -&gt; 8
0 1 0 1  -&gt; 9
0 1 1 0  -&gt; 10
0 2 0 0  -&gt; 11 



Rules
Create a function or program that takes a list of any size with non-negative integers and print or output its index. You can assume a to be at least 2. Shortest code wins. You may use 0-indexed output or 1-indexed, but specify which you use. NB: all examples here are 1-indexed.
Example code
Not golfed, in R:
nodetoindex &lt;- function(node){
  a &lt;- length(node)
  t &lt;- sum(node)
  if(t == 0) return(1)

  index &lt;- choose(t-1 + a, a)

  while(sum(node) != 0){
    x &lt;- node[1]
    sumrest &lt;- sum(node)
    if(x == 0){
      node &lt;- node[-1]
      next
    }
    a &lt;- length(node[-1])
    index &lt;- index + choose(sumrest + a, a) - choose(sumrest - x + a, a)
    node &lt;- node[-1]
  }
  return(index + 1)
} 

Test cases
10 10 10 10 -&gt; 130571
3 1 4 1 5 9 -&gt; 424407
2 9 -&gt; 69
0 0 0 -&gt; 1
0 0 1 -&gt; 2
0 0 0 0 0 0 -&gt; 1
1 0 0 0 0 1 -&gt; 23
Jelly, 8 bytes

S0rṗLSÞi


Try it online!

Brute-force solution. The first test case is too much for TIO, but I've verified it locally on my laptop. The second test case requires too much RAM, even for my desktop computer.

How it works

S0rṗLSÞi  Main link. Argument: A (array)

S         Compute the sum s of A.
 0r       Create the range [0, ..., s].
    L     Yield the length l of A.
   ṗ      Cartesian power; yield the array of all l-tuples over [0, ..., s], in
          lexicographical order.
     SÞ   Sort the l-tuples by their sums. The sorting mechanism is stable, so
          l-tuples with the same sum are still ordered lexicographically.
       i  Find the index of A in the generated array of tuples.