Here is my desired behavior:

A
0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0

A next_prime 3   NB. find the next index in A where the index greater than 
                 NB. or equal to 3

3  

But I am failing in attempt to write an explicit dyadic verb:

next_prime =: 4 : 0
n =. 0
for_i. x do.
  if ( (i = 1) * ( i_index >: y ) ) do. n =. i_index



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

Reply via email to