
Hello and welcome to:

   Prioritized Column Sort (filename: ColumnSort.e)



This include file is made to sort 'columns' of data organized into
Euphoria sequences like so:

s={
    {col1, col2, col3, col4, ...},  --row 1
    {col1, col2, col3, col4, ...},  --row 2
    {col1, col2, col3, col4, ...},  --row 3
    {etc...}                        --last row
  }


Instructions for using the functions

--To sort by one column use:
--  s=column_upper_case_sort(s,col), or s=prioritized_columns_upper_case_sort(s,{col})
--  where s is a sequence and col is an integer

--To sort by a list of columns use:
--  s=prioritized_columns_upper_case_sort(s,Columns)
--  where both s and Columns are sequences



--Example 1:  sort by one column:
--  s={ {1,2,1},{4,1,2} }
--  s=column_upper_case_sort(s,2)
--  now s=s={ {4,1,2},{1,2,1} }

--Example 2:  sort by a list of columns:
--  s={ {1,2,3}, {2,2,2}, {1,1,1} }
--  s=prioritized_columns_upper_case_sort(s,{2,3})
--  now s={ {1,1,1}, {2,2,2}, {1,2,3} }



A good example of when this is useful is when sorting filenames and
directory names.  Usually you'd want all the directory names that are
the same to be grouped together, then second level directory names,
etc., etc., then the filenames.  Of course if your application can 
keep the data stored in the correct order in the first place then
you'll see a performance increase if you use the standard sort.  In 
many cases, however, you'd want to allow the user to change the sort
order (such as by file bytes or by date) so these new functions become
very useful to have onhand.


To see two actual uses of these functions run the two demo programs
included...

test1.exw
test2.exw


Good luck!
Al
