next_prime =: (] + i.&[EMAIL PROTECTED])"_ 0
   A next_prime 3 4 5 6
3 5 5 7

Henry Rich 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Terrence Brannon
> Sent: Monday, May 21, 2007 2:59 PM
> To: [email protected]
> Subject: [Jprogramming] Finding index of first element in 
> list equal to 1 and index value greater than y
> 
> 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

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

Reply via email to