general function for sorting a matrix

Neil Cerutti horpner at yahoo.com
Wed Aug 29 19:54:01 CEST 2007


On 2007-08-29, Xah Lee <xah at xahlee.org> wrote:
> A couple years ago, i posted a programing problem, about
> writing a function that will sort a arbitrarily dimentioned
> matrix in any possible way to sort it.
>
> Such a function, is rather typical in functional programing
> languages.  I wrote a version in 1999 in perl for practical
> purposes, since sorting a matrix (i.e. list of lists) is rather
> common. With this function, i can have a single interface to
> deal with any list (including list of lists).
>
> It is ideal, that a language's function for sort actually are
> of this generality.
> (See ?What is Expressiveness in a Computer Language?, Xah Lee, 2005.
> http://xahlee.org/perl-python/what_is_expresiveness.html
> )
>
> The advantage of such a generality, is that a programer don't
> need to write a sorting code every time she encounters a list.

The advantage of such a richly implemented language as Python, is
that a programmer don't need to write a general sorting algorithm
at all.

-- 
Neil Cerutti



More information about the Python-list mailing list