How to find first element of array which satisfies the given predicate?

I'm asking because I wonder how to implement it efficiently. An array could be 
very long, say a billion elements, and chances are the first element satisfying 
a certain predicate may almost certainly be found in first, say, ten elements.

This is not about a specific problem, rather I bump into this question every 
once in a while.

Alexander

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to