## sorting one group of numbers to match another one

Jun 22 2007 | 12:52 am
I have two groups of numbers, each one in a coll, with one number per "row".
One group is a subset of the other - for example:
group A = 1 3 2 5 4 group B = 1 4 5
I want the ordering of the numbers in group B to follow the pattern set in group A; in the example above, I would like group B to be reordered like so:
1 5 4
I can think of brute force ways to do this, but I was looking for something "elegant" - any takers? I can also use lists rather than colls if that helps...
Thanks, Dan

• Jun 22 2007 | 1:21 am
Not sure if theres an 'out of the box' solution I can think of - but if an easier than brute force method exists, I bet you'd find it in L-objects.
Hope this helps
T
• Jun 22 2007 | 2:11 am
It does help Tristram - Lswap is exactly what I need. Thanks!
And thanks Peter Elsea!!!
Dan
At 7:21 PM -0600 6/21/07, Tristram Cox wrote: >Not sure if theres an 'out of the box' solution I can think of - but >if an easier than brute force method exists, I bet you'd find it in >L-objects. > >Hope this helps
-- Dan Nigrin Defective Records 202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major Malfunction http://www.defectiverecords.com http://www.jackosx.com
• Jun 22 2007 | 2:30 am
On 6/21/07 10:11 PM, "Dan Nigrin" wrote:
> It does help Tristram - Lswap is exactly what I need. Thanks! > > And thanks Peter Elsea!!! > > Dan
Cheers Gary Lee Nelson Oberlin College www.timara.oberlin.edu/GaryLeeNelson
• Jun 22 2007 | 9:56 am
• Jun 22 2007 | 11:34 am
Thanks for forcing the issue Gary - in building the example I realize now that it will not work, at least without a bit more work. I just tried playing around with the Lswap help file, and it all seemed to work fine there -- but that's because the examples I tried it with there all included "0" in the list; in my example, in which there's no 0 element in the list, it will not work:
I'm sure I can find a way around this though...
Dan
At 10:30 PM -0400 6/21/07, Gary Lee Nelson wrote: >Post your solution.
-- Dan Nigrin Defective Records 202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major Malfunction http://www.defectiverecords.com http://www.jackosx.com
• Jun 22 2007 | 11:36 am
Interesting, thanks! It seems as though zl sect preserves the order of the list that is given to it in its left inlet, which does seem like it will work for my purposes. Plus using native objects!
Thanks again, Dan
At 2:56 AM -0700 6/22/07, e.g.r. wrote: >What about zl sect ? > >#P window setfont "Sans Serif" 9.; >#P window linecount 1; >#P message 112 184 48 9109513; >#P newex 112 158 57 9109513 prepend set; >#P newex 112 131 57 9109513 zl sect; >#P message 159 67 29 9109513 1 4 5; >#P message 112 104 45 9109513 1 3 2 5 4; >#P connect 1 0 0 0; >#P connect 1 0 2 1; >#P connect 3 0 4 0; >#P connect 2 0 3 0; >#P connect 0 0 2 0; >#P window clipboard copycount 5; > >
-- Dan Nigrin Defective Records 202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major Malfunction http://www.defectiverecords.com http://www.jackosx.com
• Jun 22 2007 | 1:40 pm
Strings of max objects are clumsy for this sort of thing. Perhaps java, lisp, or my personal favorite, APL (A Programming Language). In APL this is one line of code. Java and maxlisp (is it UB yet) are already available in max. APL is a fantasy of mine. What ever happened to pyrite?
On 6/22/07 7:34 AM, "Dan Nigrin" wrote:
> Thanks for forcing the issue Gary - in building the example I realize > now that it will not work, at least without a bit more work. I just > tried playing around with the Lswap help file, and it all seemed to > work fine there -- but that's because the examples I tried it with > there all included "0" in the list; in my example, in which there's > no 0 element in the list, it will not work:
Cheers Gary Lee Nelson Oberlin College www.timara.oberlin.edu/GaryLeeNelson
• Jun 26 2007 | 1:07 pm
Gary Lee Nelson schrieb: > What ever happened to pyrite?
Turned into Supercollider long ago....
-- Stefan Tiedje------------x------- --_____-----------|-------------- --(_|_ ----|-----|-----()------- -- _|_)----|-----()-------------- ----------()--------www.ccmix.com