Hello,
[list-shellsort] should be vanilla compatible (aside from the other [list-abs] abstractions used here -- I think all the ones used are vanilla but I'm not sure - if they're not they're low-level enough that they should be ). It does need the other abstraction Frank mentioned -- [list-swap] swaps two values in a list at the given indices. I've attached it here with a helpfile, and you can find it now in the SVN tree.
https://pure-data.svn.sourceforge.net/svnroot/pure-data/trunk/abstractions/f...
Matt
Date: Tue, 2 Dec 2008 09:53:01 -0500 From: "Michal Seta" mis@artengine.ca Subject: Re: [PD] list-sort To: pd-list@iem.at Message-ID: eee389550812020653g3412bd14ka88c59c5a74d44de@mail.gmail.com Content-Type: text/plain; charset=ISO-8859-1
Hi Frank and the bees,
I obviously haven't updated my list-abs collection in a while. So much happened while I was asleep... Thanks for the improvements. I pondered doing reverse sort but I didn't need it *now* :) And I also figured, there is always [list-rev] which could be used on the result of [list-sort] and so the latter can be kept simpler. But I suspect that your solution is less costly than sticking list-rev at the end of the chain.
list-shellsort sounds like fun but it is not pd-vanilla compatible.
Cheers
./MiS
On Tue, Dec 2, 2008 at 7:59 AM, Frank Barknecht fbar@footils.org wrote:
Hallo,
oh, and I also now committed two more abstractions that Matt Barber sent me offlist, of which one is a sorting abstraction as well. Matt's [list-shellsort] uses the Shell sorting algorithm: http://en.wikipedia.org/wiki/Shell_sort which generally is a bit faster than insertion sort, but I didn't benchmark the two Pd implementations (the speed in Pd of course also depends on how much element shuffling and list-dripping is needed)
Anyway, currently list-shellsort only does ascending sorting, so I just decided to include both Michal's list-sort, which probably is easier to understand, and Matt's list-shellsort in the current SVN's [list]-abs collection. Choose your poison. ;)
Ciao
Frank
Michal Seta hat gesagt: // Michal Seta wrote:
Hi all,
It is amazing how we take things for granted. Most programming languages provide some sort of list sorting function/method. Surprisingly (or not) pd does not (or my search skills are null, or I am not bleeding edge enough). I needed a solution that works with a vanilla pd.
I was almost going to do the academia move and announce a pd exam, and have little pd-bees come up with a solution but I needed it *now* else I would not sleep or have terrible nightmares. So here it is. Thank heavens (but give your offerings to fbar's footils shrine) for list-abs.
Busy pd-bees, should you care to improve on my solution, please be my guest, I am sure there are better ways of accomplishing this trivial task. In any case, go forth and sort the world around (or within) you.
./MiS