RedRLE:
Filter:
Classes (extension) | Red > redTools

RedRLE : Object
ExtensionExtension

run-length compression/decompression
Source: RedRLE.sc

Description

See http://en.wikipedia.org/wiki/Run-length_encoding

Performs well with highly repetitive data e.g. [0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3]. Performs very bad with data containing repeating patterns e.g. [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3].

NOTE: Works with Integer, Float and Symbol. Can also take a String instead of an Array.

Class Methods

RedRLE.encode(input)

Returns an array with length, value pairs.

RedRLE.decode(input)

Array must be length, value pairs.

Inherited class methods

Instance Methods

Inherited instance methods

Examples