Range generator

Generates on command a range of numbers in form of a Queue. The range parameters can be provided at run time.

TCfg

Template data type used for the configuration interface of the rng() gear.

TCfg = Tuple[{
    'start': Integer['w_start'],
    'cnt': Integer['w_cnt'],
    'incr': Integer['w_incr']
}]
rng(cfg: TCfg, *[, cnt_steps=False, incr_steps=False]) → Queue

The type of the generated numbers is determined based on the concrete types of the TCfg fields. If any of the TCfg fields is of type Int, the generated numbers will also be Int. rng() generates numbers in range from cfg['start'] to cfg['cnt'] exclusive, with increment of cfg['incr'].

drv(t=Tuple[Uint[2], Uint[4], Uint[2]], seq=[(2, 14, 2)]) \
    | rng \
    | shred

If cnt_steps = True, then rng() generates cfg['cnt'] numbers starting from cfg['start'] with increment of cfg['incr']

rng(cfg: Integer['w_cnt']) → Queue['cfg']

Generates numbers from 0 to cfg['cnt'] - 1.

The example shows the number range generated for the input cfg = 10:

drv(t=Uint[4], seq=[10]) | rng | shred