I was reading in CSV files and experimenting with Inverted Tables
(jwiki/Essays/Inverted_Table) when I came across the following...
t=: 8!:0 <"0 i.1000 20
ifa =: <@(>"1)@|: NB. inverted from atoms
7!:2 '0&". each ifa t' NB. Convert atoms to inverted table before
making numeric
617472
7!:2 '0&". each t' NB. Make atoms numeric directly
6941888
7!:2 '0&". each ifa t' NB. Same as first one but more space
required this time
1141760
7!:2 '0&". each ifa t' NB. Back to original space required
617472
... so working with inverted tables is indeed much more space efficient,
but for some reason it requires more space if it follows directly after
an operation on a non-inverted table. Is this expected? The behaviour
doesn't' occur with smaller arrays so is it just some memory management
artifact?
7!:2 '0&". each ifa 200{.t'
163968
7!:2 '0&". each 200{.t'
1412416
7!:2 '0&". each ifa 200{.t' NB. Not bigger that first time
163968
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm