[PD] change list order according to their first element
Claude Heiland-Allen
claudiusmaximus at goto10.org
Tue Jul 27 15:00:39 CEST 2010
Hi,
On 27/07/10 12:56, Libero Mureddu wrote:
> Hello,
> I'm trying to realize something like that: I have different lists that
> I have to sort in ascending order according to their first element,
> but I cannot find a solution.
It's a tricky one in vanilla Pd.
> In other words I'd like to have the lists
> (1 a b c) (5 d e f) (3 g h i)
>
> ordered in this way:
> (1 a b c) (3 g h i) (5 d e f)
If you have pd-lua, try the attached, it's not totally perfect (ie, no
checking for lengths of lists so if you try to sort by an index that is
too big you get errors) but it works for your example.
> thanks a lot,
>
> Libero
Claude
--
http://claudiusmaximus.goto10.org
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mlist-sort.pd_lua
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100727/951e84de/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mlist-sort-help.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20100727/951e84de/attachment.asc>
More information about the Pd-list
mailing list