partition

partition, function

def process partition(max: number): number

Returns an integer from 1 to max in a repeating sequence. This helper is useful to split a table into max partitions, typically when used with scan.

Example

table T[t] = extend.range(6)
T.Part = partition(3) scan t

show table "Partitions" with
  T.N
  T.Part

This outputs the following table:

N Part
1 1
2 2
3 3
4 1
5 2
6 3

Remarks

The sequence is deterministic and repeats every max items.

User Contributed Notes
0 notes + add a note