Array.greedy_diff()
 
   
[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, ... })


Insert any HTML comment here. You can use any HTML tags and containers. Use <phl> ... </phl> if you'd like to insert some Pike / C examples or code.
 
HTML OK CSS