Given an integer n and lists L1,...,Lk of distinct nonnegative integers, this method iterates over all tuples (l1,...,lk) such that ∑i li = n and li∈Li. The tuples are produced one at a time.
Returns "null" if none.
i1 : L = {{0,1},{0,1,2},{2,3}}; |
i2 : P = nextOrderedPartition (5,L) o2 = {0, 2, 3} o2 : List |
i3 : P = nextOrderedPartition (P,5,L) o3 = {1, 1, 3} o3 : List |
i4 : P = nextOrderedPartition (P,5,L) o4 = {1, 2, 2} o4 : List |
i5 : assert(nextOrderedPartition (P,5,L) === null) |