Re: sorting matrixes

2005-03-27 Thread Xah Lee
Here's the solution to previous post. --- perl code: sub sort_matrix($$) { my $ref_matrix = $_[0]; my @indexMatrix = @{$_[1]}; my @indexes = map {$_->[0]} @indexMatrix; my @operators = map {$_->[1] ? ' cmp ' : ' <=> '} @indexMatrix; my @directions

Re: [perl-python] sorting matrixes

2005-03-22 Thread TZOTZIOY
On 22 Mar 2005 09:02:51 -0800, rumours say that "Xah Lee" <[EMAIL PROTECTED]> might have written: >Today we'll write a program that can sort a matrix in all possible >ways. > >Here's the Perl documentation. I'll post a Perl and Python version in 2 >days. Don't bother writing a Python version...

[perl-python] sorting matrixes

2005-03-22 Thread Xah Lee
Today we'll write a program that can sort a matrix in all possible ways. Here's the Perl documentation. I'll post a Perl and Python version in 2 days. --- sort_matrix( $matrix, [[$n1, $stringQ, $directionQ], [$n2, $stringQ, $directionQ], ...]) sorts a matrix by $n1 th column then $n2 th.