The timings wouldn't be as follows if u/\. were quadratic: plus=: 4 : 'x+y' timer=: 6!:2
timer 'plus/\. t' [ t=: 0 ?...@$~ 1e4 0.0873326 timer 'plus/\. t' [ t=: 0 ?...@$~ 2e4 0.148098 timer 'plus/\. t' [ t=: 0 ?...@$~ 4e4 0.210977 timer 'plus/\. t' [ t=: 0 ?...@$~ 8e4 0.361268 timer 'plus/\. t' [ t=: 0 ?...@$~ 16e4 0.613786 timer 'plus/\. t' [ t=: 0 ?...@$~ 32e4 1.18195 timer 'plus/\. t' [ t=: 0 ?...@$~ 64e4 2.20277 ----- Original Message ----- From: Zsbán Ambrus <[email protected]> Date: Friday, February 19, 2010 4:30 Subject: [Jgeneral] Special code for suffix scan To: General forum <[email protected]> > Dear Jsoftware, > > Is there any chance that a future J version would optimize the monad > u/\. for any verb u to make only linear number of calls to u instead > of quadratic? > > I know this would break the case when u has side effects, but I still > believe this would be a useful feature (if documented), for it would > help in lots of cases but break only little code. > > As a model, for any verb u and noun y, (u/\. y) could be > executed as > if it was (>,(];~>@[u>@{...@])/<"_1 y). ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
