Extracted from Pike v7.4 release 341 at 2005-11-30.
pike.ida.liu.se
[Top]
predef::
Array

Method Array.greedy_diff()


Method greedy_diff

array(array(array)) Array.greedy_diff(array from, array to)

Description

Like Array.diff , but tries to generate bigger continuous chunks of the differences, instead of maximizing the number of difference chunks. More specifically, greedy_diff optimizes the cases where Array.diff returns

({ ..., A, Z, B, ({}), C, ... })
({ ..., A, X, B,  Y+B, C, ... })
into the somewhat shorter diff arrays
({ ..., A, Z,     B+C, ... })
({ ..., A, X+B+Y, B+C, ... })