For a little more color: previous discussion: http://www.jsoftware.com/pipermail/programming/2014-March/035994.html
I'm going to switch back to using i. for this On Tue, Jan 10, 2017 at 6:15 PM, Joe Bogner <[email protected]> wrote: > Looks like it is due to the boxing. Please disregard > > http://code.jsoftware.com/wiki/Vocabulary/comma#dyadic mentions that > append in place special code does not work for boxes > > f4 =: 3 : 0 > > a=:a: > > for_n. (i. y) do. a=:a,(<n) end. > > ) > > > (6!:2) 'f4 100' > > 0.000336555 > > (6!:2) 'f4 1000' > > 0.0149772 > > (6!:2) 'f4 10000' > > 0.667025 > > (6!:2) 'f4 20000' > > 2.69115 > > (6!:2) 'f4 100000' > > 170.261 > > > > > On Tue, Jan 10, 2017 at 5:26 PM, Joe Bogner <[email protected]> wrote: > >> Why are these so different in execution speed? I'm surprised assembling >> that linking boxes makes that much of a difference over an number. I need >> it to be boxed because I'm going to something more complex with each >> iteration. >> >> f1 =: 3 : '(>: each)^:(<y) (<0)' >> >> (6!:2) 'f1 100' >> 6.01622e_5 >> (6!:2) 'f1 1000' >> 0.0012719 >> (6!:2) 'f1 10000' >> 0.145702 >> (6!:2) 'f1 100000' >> 33.0624 >> >> f2 =: 3 : '(>:)^:(<y) (0)' >> >> (6!:2) 'f2 100' >> 4.24675e_5 >> (6!:2) 'f2 1000' >> 0.000189688 >> (6!:2) 'f2 10000' >> 0.00180487 >> (6!:2) 'f2 100000' >> 0.0256836 >> >> >> I'm thinking of using ^: to execute something N times with an increasing >> argument. >> >> I could use i. but wanted to try something different >> >> >> JVERSION >> >> Engine: j805/j64/windows >> >> Release: commercial/2016-12-11T08:02:16 >> >> Library: 8.05.11 >> >> Qt IDE: 1.5.3s/5.6.2 >> >> Platform: Win 64 >> >> Installer: J805 install >> >> InstallPath: c:/program files/j64-805 >> >> Contact: www.jsoftware.com >> > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
