Answers to such questions can be obtained through experiments: 7!:0 '' 1236480 a=: 16000$'a' 7!:0 '' 1252928 b=: 100$<a 7!:0 '' 1253504
----- Original Message ----- From: Rob Hodgkinson <[EMAIL PROTECTED]> Date: Tuesday, September 16, 2008 19:05 Subject: [Jprogramming] Re: Query about 7!:5 for boxed nouns (was: Questions about mapped files (improved)) To: Programming forum <[email protected]> > > Interesting note Dan about the space occupied by a boxed > noun > containing multiple identical references. > > I would have thought the following would only show a marginal > increase > in space from z to zz (as zz contains 5 references to z): > > z=:<i.100 100 > 7!:5<'z' > 65600 > zz=:5$z > 7!:5<'zz' > 327744 > > This reports 5 x the space, but I would have expected (1 x space > of z > + 5 x references to z). > > Roger, could this discrepancy be in the calculation of space > used by > 7!:5 when a boxed noun includes an array of the same references ? > > .../Rob Hodgkinson > > On 16/09/2008, at 4:02 AM, Dan Bron wrote: > > ... > > > > Still, I'm surprised by your second observation, as I thought > that > > the expression x $ < y was optimized by > creating an array of > > pointers to the same box, rather than copying the actually > data. As > > in: > > > > z=.i. 1000 1000 > > 7!:5<'z' > > 4.1943e6 > > > > Z=.1 $ z > > 7!:5<'Z' > > 4096 > > > > Z=.4 $ z > > 7!:5<'Z' > > 16384 > > > > Z=.4 4 4 $ z > > 7!:5<'Z' > > 262144 > > > > -Dan ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
