heapster-saw/examples/linked_list.c
/* Test if some element of a list satisfies a given predicate */
Test if some element of a list satisfies a given predicate
Test if some element of a list satisfies a given predicate
int64_t any (int64_t (*pred) (int64_t), list64_t *l) {
  if (l == NULL) {
    return 0;
  } else if (pred (l->data)) {
    return 1;
  } else {
    return any (pred, l->next);
  }
}
int64_t any ( int64_t ( * pred ) ( int64_t ) , list64_t * l ) { if ( l == NULL ) { return 0 ; } else if ( pred ( l -> data ) ) { return 1 ; } else { return any ( pred , l -> next ) ; } }
Test if some element of a list satisfies a given predicate
Test if some element of a list satisfies a given predicate