MergedBackwards:
PUBLIC
PROC [reader: Ref]
RETURNS [count: Offset, looks: Looks]
--RunReader.ReaderProc-- = {
[count,looks] ← Backwards[reader];
WHILE reader.current=reader.first
OR reader.changeLooks
DO
nxtCount: Offset;
nxtLooks: Looks;
[nxtCount,nxtLooks] ← PeekBackwards[reader ! NoMoreRuns => EXIT];
IF nxtLooks#looks THEN RETURN;
count ← count+nxtCount;
[,] ← Backwards[reader];
ENDLOOP };
}.