ple=: i.&.(p:^:_1)@>:
   ple 30
2 3 5 7 11 13 17 19 23 29
   ple 31
2 3 5 7 11 13 17 19 23 29 31
   ple 32
2 3 5 7 11 13 17 19 23 29 31

Or, alternatively,

   ple=: pl@>:

where pl is what you have already defined.



----- Original Message -----
From: Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]>
Date: Wednesday, September 20, 2006 8:30 pm
Subject: Re: [Jprogramming] Explicit to Tacit - newbie question

> Thanks!
> 
> Interesting  use of the dual/under operator &. Although I had 
> studied the
> form, this usage didnot occur to me!
> 
> As an extension question:
> 
> p1 =: i. &. (p:^:_1)     NB. primes strictly less than number
> 
> so,
> p1 37
> 2 3 5 7 11 13 17 19 23 29 31
> 
> In the generated list, I want the number included if it is prime. 
> What would
> that extension be using &. ?
> Or, does that need compelete verb definition?


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

Reply via email to