deps/kb_meme/meme-5.0.1/src/array-list.c
/*
 * arraylst_accumulate_range
 * Applies a function to each item in a range of the array list combining it 
 * with an accumulated value. The accumulated value is returned.
 */
arraylst_accumulate_range
Applies a function to each item in a range of the array list combining it
with an accumulated value. The accumulated value is returned.
arraylst_accumulate_range Applies a function to each item in a range of the array list combining it with an accumulated value . The accumulated value is returned .
void* arraylst_accumulate_range(void (*accumulator_fun)(void*, void*), void *initval, int index, int count, ARRAYLST_T *arraylst) {
  int i;
  void *val;
  if (arraylst == NULL)                       die("arraylst_accumulate_range: arraylst is NULL!\n"); 
  if (accumulator_fun == NULL)                die("arraylst_accumulate_range: accumulator_fun is NULL!\n");
  if (count < 0)                              die("arraylst_accumulate_range: count must be zero or more elements.\n"); 
  if (index < 0 || index > arraylst->size)    die("arraylst_accumulate_range: index must be within bounds.\n");
  if(index + count > arraylst->size)          die("arraylst_accumulate_range: index + count is larger than size!\n");
  val = initval;
  for (i = index; i < count; ++i) {
    accumulator_fun(arraylst->array[i], val);
  }
  return val;
}
void * arraylst_accumulate_range ( void ( * accumulator_fun ) ( void * , void * ) , void * initval , int index , int count , ARRAYLST_T * arraylst ) { int i ; void * val ; if ( arraylst == NULL ) die ( " \n " ) ; if ( accumulator_fun == NULL ) die ( " \n " ) ; if ( count < 0 ) die ( " \n " ) ; if ( index < 0 || index > arraylst -> size ) die ( " \n " ) ; if ( index + count > arraylst -> size ) die ( " \n " ) ; val = initval ; for ( i = index ; i < count ; ++ i ) { accumulator_fun ( arraylst -> array [ i ] , val ) ; } return val ; }
arraylst_accumulate_range
 Applies a function to each item in a range of the array list combining it
 with an accumulated value.
arraylst_accumulate_range Applies a function to each item in a range of the array list combining it with an accumulated value .