scaleex-scale.html
doubleCode_samples.html
merge
sumex-sum.html
dxex-dx.html
wiring functionsex-msfl.html
histoex-histo.html
RLEex-rle.html
convolex-conv.html
higher order
actorex-fmap.html
 

actor merge

  in (i1:unsigned<s>, i2:unsigned<s>)

  out (o:unsigned<s>)

var s: {Left, Right} = Left

rules

| (s:Left,  i1:x) -> (o:x, s:Right)

| (s:Right, i2:x) -> (o:x, s:Left)

;

This actor merges two data streams by copying alternatively the value on its left (i1) and right (i2) input to its output.

For example, if the stream on input i1 is : 8 4 6 ...

and the stream on input i2 is :                   9 5 4 ...

then the stream on output o will be :          8 9 4 5 6 4 ...


The local variable s (with an enumerated type) keeps track of which input to read at the next activation.