Processes a RLE sequence of count elements generated by the gen function, and calls emit function for every RLE segment