deal

qdeal(din: Queue, *, num, lvl=din.lvl-1) → (Queue[din.data, din.lvl-1], )*num

Sends elements of the input Queue to the outputs in Round-robin order. Number of outputs is specified using num parameter. With higher-level input Queue -s also the lvl parameter can be specified which determines the granularity at which the elements are dealt.

In this example, whole Queue -s are being dealt, hence lvl=1

seq = [[1, 2], [3, 4], [5, 6], [7, 8]]
din = drv(t=Queue[Uint[4], 2], seq=[seq])

do1, do2 = din | qdeal(num=2, lvl=1)
do1 | check(ref=[[1, 2], [5, 6]])
do2 | check(ref=[[3, 4], [7, 8]])

Here though, for the same input only a single element is dealt at a time, hence lvl=0

seq = [[1, 2], [3, 4], [5, 6], [7, 8]]
din = drv(t=Queue[Uint[4], 2], seq=[seq])

do1, do2 = din | qdeal(num=2, lvl=0)
do1 | check(ref=[[1, 3, 5, 7]])
do2 | check(ref=[[2, 4, 6, 8]])