# runLengthEncode(VisibleList) -- run length encoding

## Synopsis

• Function: runLengthEncode
• Usage:
runLengthEncode x
• Inputs:
• x,
• Outputs:
• a list equivalent to x, in which runs and sequences have been expressed symbolically as expressions

## Description

The result is useful in printed displays, as a way of making them more compact. The original list can be recovered by applying value to the elements of the result, and then using deepSplice, provided that x contains no entries that are sequences.

 i1 : x = {1,2,3,a,b,c,a,b,c,4,4,4,"asdf"}; i2 : y = runLengthEncode x o2 = {1..3, 2:a..c, 3:4, asdf} o2 : List i3 : peek y o3 = {BinaryOperation{.., 1, 3}, BinaryOperation{:, 2, a..c}, ------------------------------------------------------------------------ BinaryOperation{:, 3, 4}, Holder{asdf}} i4 : value \ y o4 = {(1, 2, 3), ((a, b, c), (a, b, c)), (4, 4, 4), asdf} o4 : List i5 : deepSplice \\ oo o5 = {1, 2, 3, a, b, c, a, b, c, 4, 4, 4, asdf} o5 : List i6 : x === oo o6 = true