pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:7218:    push_array(friendly_slice_array(a,ai+1,a->size));    ad=append_array(ad,Pike_sp-1);    pop_stack();    }       push_array(ad);    push_array(bd);    return aggregate_array(2);   }    - /*! @decl array permute(array in, int number) + /*! @decl array permute(array in, int(0..) number)    *!    *! Give a specified permutation of an array.    *!    *! The number of permutations is equal to @expr{sizeof(@[in])!@}    *! (the factorial of the size of the given array).    *!    *! @seealso    *! @[shuffle()]    */   PMOD_EXPORT void f_permute( INT32 args )
pike.git/src/builtin_functions.c:7242:    struct svalue *it;       if( args != 2 )    SIMPLE_TOO_FEW_ARGS_ERROR("permute", 2);    if( TYPEOF(Pike_sp[ -2 ]) != T_ARRAY )    SIMPLE_BAD_ARG_ERROR("permute", 1, "array");    if (TYPEOF(Pike_sp[ -1 ]) != T_INT)    SIMPLE_BAD_ARG_ERROR("permute", 2, "int");       n = Pike_sp[ -1 ].u.integer; +  if( n<0 ) Pike_error("Only positive permutations are allowed.\n");    a = copy_array( Pike_sp[ -2 ].u.array );    pop_n_elems( args );    q = a->size;    it = a->item;    while( n && q )    {    int x = n % q;    n /= q;    q--;    if( x )
pike.git/src/builtin_functions.c:10170:    ADD_FUNCTION2("interleave_array", f_interleave_array,    tFunc(tArr(tMap(tInt, tMix)), tArr(tInt)), 0,    OPT_TRY_OPTIMIZE);    /* function(array(0=mixed),array(1=mixed):array(array(array(0)|array(1))) */    ADD_FUNCTION2("diff", f_diff,    tFunc(tArr(tSetvar(0,tMix)) tArr(tSetvar(1,tMix)),    tArr(tArr(tOr(tArr(tVar(0)),tArr(tVar(1)))))), 0,    OPT_TRY_OPTIMIZE);       /* Generate the n:th permutation of the array given as the first argument */ -  ADD_FUNCTION2("permute", f_permute, tFunc(tArray tInt,tArray), 0, +  ADD_FUNCTION2("permute", f_permute, tFunc(tArray tIntPos,tArray), 0,    OPT_TRY_OPTIMIZE);       /* function(array,array:array(int)) */    ADD_FUNCTION2("diff_longest_sequence", f_diff_longest_sequence,    tFunc(tArray tArray,tArr(tInt)), 0, OPT_TRY_OPTIMIZE);    /* function(array,array:array(int)) */    ADD_FUNCTION2("diff_dyn_longest_sequence", f_diff_dyn_longest_sequence,    tFunc(tArray tArray,tArr(tInt)), 0, OPT_TRY_OPTIMIZE);    /* function(array,array:array(array)) */    ADD_FUNCTION2("diff_compare_table", f_diff_compare_table,