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 usingnum
parameter. With higher-level inputQueue
-s also thelvl
parameter can be specified which determines the granularity at which the elements are dealt.In this example, whole
Queue
-s are being dealt, hencelvl=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]])