[PD] sigmund list sort

Mathieu Bouchard matju at artengine.ca
Sat Feb 18 19:14:22 CET 2012

Le 2012-02-18 à 09:58:00, Miller Puckette a écrit :

> I believe there's no good way to do this in pd vanilla.  THere should be 
> a 'list sort' but I haven't figured out what would be the best design. 
> (and there's probably already a list sort in Pd extended :)

the [list-sort] abstraction uses a high-constant O(n²) algorithm that 
breaks once you try to sort more than 125 values. For [sigmund~]'s output 
this is not very relevant, what's relevant is that it can't deal with more 
than one « column », that is, it can't sort pairs of numbers.

That's why I mention [#grade]. Not only it's using a lean O(n log n) 
algorithm that can work on millions of elements, it also gives you the 
ordering instead of applying the sorting. This means that you can fairly 
easily construct a sorter by any kind of key column, including cases 
computed on the fly (e.g. sort according to dbA computed using both 
amplitude and frequencies, where the dbA is not part of the table).

That kind of modular design is something I borrowed from the APL language.

| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC

More information about the Pd-list mailing list