One good application of sparse arrays is tracking differences in a large (or 
medium) datasets.  Its possible for 1 billion rows to only have a few dozen 
fields that have changed in the last period.  Sparse arrays are also good for 
preparing mass updates to a dataset, for example by applying the above small 
differences sparse set to the large dataset with sparse_differences + data.

Once you start think that way, its easy to imagine that you might want to work 
with a list of such differences, or store these differences with associated 
data (such as differences to what and when), or pass the differences to verbs 
along with other parameters (parameters separated by ; that could include what 
and when).

There is a workaround to use lr or 3!:1 to encode the sparse array, and then 
box that with something else.  Still, working with very sparse arrays would be 
easier with allowing them to be boxed.

On the subject of suggestions for sparse arrays, they could be made even 
sparser if the fill element could apply to the full shape of the "item".  For 
example:

   $. 5 2 $ 0 2
0 1 │ 2
1 1 │ 2
2 1 │ 2
3 1 │ 2
4 1 │ 2

   lr $. 5 2 $ 0 2
2 2 2 2 2 ((<"1)5 2$0 1 1 1 2 1 3 1 4 1)}1$.5 2;0 1;0+-~2

It could be possible that this were not a rank error:

   1$.5 2;0 1;0 2


ie. setting the fill element to be 0 2.

The workaround for this is to have multiple parallel sparse arrays, which 
brings us back to grouping them for instance through boxes.  Roughly the same 
pattern as inverted tables ( 
http://www.jsoftware.com/jwiki/Essays/Inverted%20Table) .  The analogy to data 
tables is having fields with different default values, and sparse data only 
storing non defaults.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to