Oleg Kobchenko:
> How about this for a simple unoptimized solution:
> 
> dice2=: 9999&$: : (4 : 0)"0
>   d=. x (>[EMAIL PROTECTED] # [) y
>   while. y <: z=. (#.?) d do. end.
>   z
> )

Not very practical. For one thing, in the form it is written
it fails to produce desired result on large extended
integers, the entire reason for this endevour.
Even with the obvious fix try 

   6!:2 'z=.9999x dice2  9999#.1,150$9998x'
9.34617

and compare it to the verb from wiki.

Depending on how paranoid you are about your random
numbers, rnd can be expensive operation. It makes practical sense
for the algorithm to discard as little of precious
randomness as possible.
 
> JavaScript and Java do have a goto statement,
> it's just called differently to fit with the structural model.
> That explains it why your JavaScirpt programs look
> so nicely readable and unobfuscated--you just haven't
> discovered it.

I am not sure which one you are referring to, switch, or
throw/catch pair, please elaborate.

Neither of them would work naturally in this situation. Or
you can demonstrate otherwise, if you disagree.

I am amazed how decades of brainwashing and propaganda (I am
referring here to goto bashing) really make some people not to
see the obvious. And you, among all the rest, should be at
least slightly inoculated to such things.

The naked truth is: goto is very effective, simple, straightforward,
predictable and easy to read construct. Any convoluted
attempts to avoid it in places where goto is appropriate lead
to atrocities far uglier than any mild occasional misuse of goto.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to