R.E. Boss schreef:
> Tried
>
> kCnM=: 4 : 0 M.
>   if. x>:#y do. y
>   else. if. x>1 do. (({.y),.(x-1)kCnM}.y),x kCnM}.y
>         else. ,.y end.
>   end.
> )
>
> but even then
>
>    et '6 kCnM r'      NB. first call; et=:6!:2
> 0.078162731
I don't understand the purpose of M. here.
IMO there are no reusable value's.
Hence saving values is useless.

With and without M.

first call:
   ts '6 kCn r'
0.126127 593152  

second call
  ts '6 kCn r'
0.126622 593152

Without is faster:
   ts '6 kCn r'
0.105369 593152


=@@i
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to