NAME assoc - Assoc in an alist (but use mappings instead..) SYNOPSIS mixed assoc(mixed key, mixed *keys, mixed *|void data_or_fail, mixed|void fail); DESCRIPTION Searches a key in an alist. Three modes of calling: i ) With exactly two arguments, the second being an array which's first element is no array. In this case the entire array is searched for the key; -1 is returned if not found, else the index ( like member_array, but faster ). ii) With two or three arguments, the second being an array which's first element is an array. The array has to have a second element of the same size; the key is searched in the first and the associated element of the second array that is element of second argument is returned if succesful; if not, 0 is returned, or the third argument, if given. iii) With three or four arguments, the second being an array of keys ( first element no array ) and the second is a matching data array. returns 0 or fourth argument ( if given ) for failure, or the matching entry in the array given as third argument for success. Complexity : O( lg(n) ) , where n is the number of keys. NOTE Return value is undefined if another list is given in place of a presorted key list. SEE ALSO LPC/alists, order_alist, insert_alist
Help topics available:
add_verb | assoc | create_wizard | extract | insert_alist |
order_alist | slice_array |
You are guest number 75 since November 2019.
This file was last modified: June 2000.