[Jprogramming] Use of (@) 'Atop'
Martin Kreuzer
info at airkreuzer.com
Thu Jul 7 13:28:02 UTC 2016
Thanks for the link; now quite comprehensible ...
-M
At 2016-07-07 12:56, you wrote:
>http://www.jsoftware.com/help/release/random.htm#scode
>
>Thanks,
>
>--
>Raul
>
>
>On Thu, Jul 7, 2016 at 8:37 AM, Martin Kreuzer <info at airkreuzer.com> wrote:
> > Hi all -
>
> > Approximating Pi using the Monte Carlo method (circle enscribed in unit
> > square) came up with
>
> > pia=. 13 : '(4 * y %~ +/ 1 >: +/ *: <: +: ? (2,y) $ 0)'("0)
> > (pia 10^(4+i.3)) ,:(4+i.3)
> > 3.1524 3.1438 3.14106
> > 4 5 6
>
> > I then compared my version with the J verb at Rosetta Code and the only
> > difference I found was the use of 'Atop':
>
> > piMC=: monad define "0
> > 4* y%~ +/ 1>: %: +/ *: <: +: (2,y) ?@$ 0
> > )
>
> > Q:
> > What is the advantage (in this particular case) of using 'Atop'..?
> > ? (2,y) $ 0
> > vs
> > (2,y) ?@$ 0
>
> > Thanks
> > -M
>
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list