f produces an atom numeric result on each cell (or pair 
of cells).  It seems worthwhile to implement special code 
for  f i. 1: (f i. 0: and f i: 1: etc.) so that it stops as soon 
as it finds the targeted value.

Special code already exists for (comp i. 1:) , 
http://www.jsoftware.com/help/release/compsc.htm
done starting in J5.01, as the following example 
demonstrates:

   x=: 1e6 [EMAIL PROTECTED] 0
   0.9 (< i. 1:) x
2
   (0.9<x) i. 1
2
   ts '0.9 (< i. 1:) x'
1.70413e_5 1152
   ts '(0.9<x) i. 1'
0.0428736 1.04947e6

Even if the target is not found, i.e. if the entire
argument has to be scanned, the special code
still wins:

   1 (< i. 1:) x
1000000
   (1<x) i. 1
1000000
   ts '1 (< i. 1:) x'
0.0146362 1088
   ts '(1<x) i. 1'
0.0383577 1.04928e6
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to