http://www.jsoftware.com/help/dictionary/dx006.htm says:

6!:3 y Delay. Delay execution for y seconds. For example, 6!:3 (2.5)

but today I ran into an example where that did not seem to be what it was doing.

Rather than go into the full complexity of that example, let's try
doing a two second delay in ten steps:

   delay=: 6!:3"0
   timespacex 'delay 10#0.2'
3.6e_5 2432

Pretty fast right? Two seconds compressed into less than a millisecond...

My guess is that J's using an api mechanism (sleep) which only
supports integer seconds and it's discarding the fractions.

As an alternative:

Linux/OSX/etc.: nanosleep
Windows: sleep (has millisecond precision)

(In other words, all I really needed to do to fix this problem was
switch operating systems.)

Thanks,

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

Reply via email to