Yesterday, I wrote:
> example=:4 :0  NB. a example b
>   c=.1+I.y
>   while.1 e. s=.c >&({&x) I.y do.
>      c=.c+s
>   end.
>   c
> )
>
>   A=: 0,~ ([EMAIL PROTECTED])(-<./)+/\<:?.1e3#3
>   B=: 0,~?.2#~<:#A
>   (6!:2,7!:2) 'A example B'
> 0.306458 149824
>
> Can you do better than this?

I guess this problem must not be very interesting, but here's a
trivial change which gives me a 30% speedup:
example=:4 :0  NB. a example b
  c=.1+Iy=.I.y
  while.1 e. s=.c >&({&x) Iy do.
     c=.c+s
  end.
  c
)
   ts'A example B'
0.202472 149824

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

Reply via email to