pike.git / lib / modules / Array.pmod

version» Context lines:

pike.git/lib/modules/Array.pmod:127:   //! This function sorts an array after a compare-function @[cmp]   //! which takes two arguments and should return @tt{1@} if the first argument   //! is larger then the second.   //!   //! The remaining arguments @[args] will be sent as 3rd, 4th etc. argument   //! to @[cmp].   //!   //! If @[cmp] is omitted, @[`>()] is used instead.   //!   //! @seealso - //! @[map()], @[sort()], @[`>()] + //! @[map()], @[sort()], @[`>()], @[dwim_sort_func], @[lyskom_sort_func]   //!   array sort_array(array foo, function|void cmp, mixed ... args)   {    array bar,tmp;    int len,start;    int length;    int foop, fooend, barp, barend;       if(!cmp || cmp==`>)    {
pike.git/lib/modules/Array.pmod:452:   // " x=%d l=%d:%d r=%d:%d \n",@res[-1],x,l,lpos,r,rpos));       rpos+=x;    lpos+=x;    n+=x;    }       return transpose(res);   }    - //! Sort without + //! Sort without respect to number formatting (most notably leading + //! zeroes).   int dwim_sort_func(string a, string b)   {    if (a==b) return 0;    array aa=({}), bb=({});    int state, oi;       for( int i = 0; i<sizeof(a); i++ )    if( (<'0','1','2','3','4','5','6','7','8','9'>)[a[i]] != state )    {    state = !state;
pike.git/lib/modules/Array.pmod:551:    {    mixed mem=`+(@a[..999]);    int j=1000;    array v;    while (sizeof(v=a[j..j+999]))    mem=`+(mem,@v),j+=1000;    return mem;    }   }    + //! @decl array uniq(array a) + //! Perform uniq on an array: + //! aabbbcaababb -> abc +    //! Perform the same action as the Unix uniq command on an array, -  + //! that is, fold consecutive occurrences of the same element into + //! a single element of the result array: + //!   //! aabbbcaababb -> abcabab.   //!   //! See also the @[uniq] function.   array uniq2(array a)   {    array res;    mixed last;    if (!sizeof(a)) return ({});    res=({last=a[0]});    foreach (a,mixed v)