There are optimizations but they require that you express the computation differently, in this case as +/@:< . The optimizations are listed in Appendix B of the dictionary. http://www.jsoftware.com/help/dictionary/special.htm
You can detect that special code is being employed by doing some benchmarks. e.g. x=: 5 y=: 1e6 [EMAIL PROTECTED] 10 ts=: 6!:2 , 7!:[EMAIL PROTECTED] NB. time and space ts '+/x<y' 0.00817115 1.0496e6 ts 'x +/@:< y' 0.00583091 1152 ----- Original Message ----- From: Terrence Brannon <[EMAIL PROTECTED]> Date: Wednesday, March 28, 2007 12:57 pm Subject: [Jgeneral] optimization of array passes? > Given this verb: > > +/ 4 < 3 1 4 1 5 9 > > does it go through the list once with the verb < and then again > with the verb +/ > or can it do it in one pass like I could in C? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
