To give an example - to sort on col 2, 4 reverse, and then 3 could be done using something like this:
m2 = sortmap(col[2])
m3 = sortmap(col[3])
m4 = sortmap(col[4])
result = view.remap(m3.remap(reverse(m4)).remap(m2))
(with partial use, i.e. when fetching only a slice of the result, all sorts of neat tricks can be added, leading to behavior which I think resembles what you are describing above)
Except that the above "permutation stacking" is not exactly right... alas.
I think you need another piece of data. Imagine if your sortmap produced the following where order is the sort order and index is the index into the original view. Row is just the index in the view for my sanity.
sortmap on column 1 Row # order index 0 0 7 1 0 5 2 1 4 3 2 3 4 3 2 5 4 11 6 4 18 7 4 1
sortmap on column 2 Row # order index 0 0 1 1 0 7 2 1 4 3 2 11 4 3 2 5 4 18 6 4 12 7 4 5
You can lazily evaluate secondary keys as follows.
Imagine we are looking to find the index for sorted row #6. We look at the first sortmap and notice that there are multiple entries for order 4. This is a linear scan to lower rows and higher rows that assembles potential indices 11,18,1 where we want to find the second entry (since row 6 is the second 4)
Now take the second sort map and isolate indices 11,18,1 row # order index 0 0 1 3 2 11 5 4 18
And the answer is original row 11!
vw[6] -> machinations -> is original row 11 This could be nested indefinanetly.
Pretty cool eh?
-jcw
_____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit
_____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit
