This actor computes the runlength encoding (RLE) of a sequence of values.
For example, if the stream on input i is :
1 1 1 6 6 6 6 6 8 8 8 8 ...
then the stream on output o will be :
RL(1,3) RL(6,5) RL(8,4) ...
Runlengths are encoded using the userdefined algebraic rl.
t RL<n> is the type of runlengths where t is the type of the sequence elements and n the number of bits used for coding the length.
Once the first value has been read on input i (after first rule has been activated and the state variable st set to Run), the behavior of the actor is described by rules 2 and 3, which can be read as follows :

• if the next value (v) read on input i is equal to the value of the current run (stored in local variable c), then increment the run length counter k (rule #2)

• otherwise, output the run descriptor on output o (value c and length k), set c to the new value read on input i and counter k to 1 (rule #3)