On Fri, Aug 8, 2008 at 4:22 PM, Robert Cyr <[EMAIL PROTECTED]> wrote:
> poissonran=: 4 : 0
> n=. 5*x
> (+/\(^-x)**/\1,x%}.i.>:n)I.?y$0
> )

Translated to tacit form, this becomes:

   pr=: [EMAIL PROTECTED]&[EMAIL PROTECTED] I.~ [EMAIL PROTECTED]@[ +/\@:* 1 
*/\@, [ % 1 + 5 [EMAIL PROTECTED] [

Translated back to explicit form, that becomes:

prn=: 4 :0
   (?y$0) I.~ +/\ (^-x)* */\1, x% 1+ i.5* x
)

And, if we take Henry Rich's advice and factor out the threshold
list, that explicit form becomes:

prth=: 3 :0
   +/\ (^-x)* */\1, x% 1+ i.5* x
)
prl=: 4 :0
   x I. ?y$0
)

Usage example:
   (prth 100) prl 1e4

[But, of course, to take advantage of the speed up, you would
want to store the deterministic result (prth 100) in a variable.]

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

Reply via email to