array.c
//iterates thru all elements in array at param ap, and returns a new array containing those that satisfy (*boolean_lamdba)(int)
//boolean lamdba function pointer must take an parameter of same type as array, and return true if satisfied, false otherwise
//returns NULL if fails
iterates thru all elements in array at param ap, and returns a new array containing those that satisfy (*boolean_lamdba)(int)
boolean lamdba function pointer must take an parameter of same type as array, and return true if satisfied, false otherwise
returns NULL if fails
iterates thru all elements in array at param ap and returns a new array containing those that satisfy ( * boolean_lamdba ) ( int ) boolean lamdba function pointer must take an parameter of same type as array and return true if satisfied false otherwise returns NULL if fails
array_t* array_select(array_t* ap, int (*boolean_lambda)(int iter)) {
	array_t* ret = new_array(10);
	int i;
	for(i=0; i<ap->length; i++) {
		if( boolean_lambda(ap->array[i]) ) {
			if( !array_append(ret, ap->array[i]) ) {
				destroy_array(ret);
				return(NULL);
			}
		}
	}
	return(ret);
}
array_t * array_select ( array_t * ap , int ( * boolean_lambda ) ( int iter ) ) { array_t * ret = new_array ( 10 ) ; int i ; for ( i = 0 ; i < ap -> length ; i ++ ) { if ( boolean_lambda ( ap -> array [ i ] ) ) { if ( ! array_append ( ret , ap -> array [ i ] ) ) { destroy_array ( ret ) ; return ( NULL ) ; } } } return ( ret ) ; }
iterates thru all elements in array at param ap, and returns a new array containing those that satisfy (*boolean_lamdba)(int)
boolean lamdba function pointer must take an parameter of same type as array, and return true if satisfied, false otherwise
returns NULL if fails
iterates thru all elements in array at param ap and returns a new array containing those that satisfy ( * boolean_lamdba ) ( int ) boolean lamdba function pointer must take an parameter of same type as array and return true if satisfied false otherwise returns NULL if fails