> From: bill lam > > On Mon, 07 Sep 2009, PackRat wrote: > > In the real world, t1 and t2 (and several additional rows) have over > > 20,000 values of market data. What I'm trying (unsuccessfully) to do > > I suspect it'll be more efficient to unbox and box as a single > operation. > > <"1 mm#"1>t1 > +--------+--------+--------+--------+ > |20090904|20090903|20090902|20090901| > +--------+--------+--------+--------+ > > But I would rather store it as a rank-2 character array than as a box > array of rank-1 strings if the number of rows is large.
In general terms I think this is good advice but &.> is optimized so: t1=: '2009-09-04';'2009-09-03';'2009-09-02';'2009-09-01' tst=: 1e5 $ t1 mm=. 1 1 1 1 0 1 1 0 1 1 NB. yyyy-mm-dd --> yyyymmdd ts=: 6!:2 , 7!:2...@] 30 ts 'mm&# &.>tst' 0.0399040799836 7334976 30 ts 'mm #L:0 tst' 0.0386091364321 7335040 30 ts '<"1 mm#"1>tst' 0.0397885000191 9432512 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
