pike.git / lib / modules / Array.pmod

version» Context lines:

pike.git/lib/modules/Array.pmod:661:   //! differences, instead of maximizing the number of difference chunks. More   //! specifically, @[greedy_diff] optimizes the cases where @[Array.diff] returns   //! @code{({ ..., A, Z, B, ({}), C, ... })@}   //! @code{({ ..., A, X, B, Y+B, C, ... })@}   //! into the somewhat shorter diff arrays   //! @code{({ ..., A, Z, B+C, ... })@}   //! @code{({ ..., A, X+B+Y, B+C, ... })@}   array(array(array)) greedy_diff(array from, array to)   {    array(array) d1, d2; -  [d1, d2] = Array.diff(from, to); +  [d1, d2] = diff(from, to);    [d2, d1] = low_greedy_diff(d2, d1);    return low_greedy_diff(d1, d2);   }      //! @decl int count(array|mapping|multiset haystack, mixed needle)   //! @decl mapping(mixed:int) count(array|mapping|multiset haystack)   //! Returns the number of occurrences of @[needle] in @[haystack].   //! If the optional @[needle] argument is omitted, @[count] instead   //! works similar to the unix command @tt{sort|uniq -c@}, returning   //! a mapping with the number of occurrences of each element in