filter list according to position

May 20, 2006 at 8:58am

filter list according to position

hi

it must be a really simple one (i know how to do it in OpenMusic) but
i can not find how to do it in max:

i have a list names ( +/- 600) : could be apple, orange, kiwi,
banana, coconut ……

and a list of wanted “positions” – say 1 3 4

i want to filter the 1rst list according to positions, so that

apple, orange, kiwi, banana, coconut

filtered by

1 3 4

returns

apple, kiwi, banana….

___must be simple….. could anyone give me a hint, how to do it??

many thanks

kasper

Kasper T. Toeplitz
noise, composition, bass, computer

http://www.sleazeArt.com

#26078
May 20, 2006 at 9:14am

if you fill a coll with this list you automatically
get an 1,2,3 index to each symbol … and you can call
them from the index numbers

if it wouldnt be 600 but <64 i would say just make
them a list “1 banana 2 kiwi ..” which is eassy with
a few zl objects and pak/unpack

#77492
May 20, 2006 at 9:22am

hummmm, the idea of a coll is not bad – but i not only want to CALL
the objects but i want to have a list containing ONLY the chosen
ones….

many thanks

best

kasper

#77493
May 20, 2006 at 9:28am

heres an example using the zl object

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P message 321 59 29 9109513 2 3 5;
#P message 268 268 162 9109513 apple orange banana;
#P newex 268 238 57 9109513 prepend set;
#P newex 321 103 29 9109513 zl len;
#P newex 268 206 40 9109513 zl group;
#P button 102 87 15 0;
#P newex 288 103 21 9109513 iter;
#P message 288 59 29 9109513 1 2 4;
#P newex 268 159 30 9109513 zl nth;
#P message 102 105 162 9109513 apple orange kiwi banana watermelon;
#P comment 362 59 100 9109513 list triggers output;
#P connect 10 0 4 0;
#P connect 10 0 7 0;
#P fasten 4 0 5 0 293 126 276 126 276 83 107 83;
#P connect 4 0 2 1;
#P connect 3 0 4 0;
#P connect 3 0 7 0;
#P connect 8 0 9 0;
#P connect 6 0 8 0;
#P connect 2 0 6 0;
#P fasten 7 0 6 1 326 199 303 199;
#P fasten 1 0 2 0 107 145 273 145;
#P connect 5 0 1 0;
#P window clipboard copycount 11;

#77494
May 20, 2006 at 9:35am

>heres an example using the zl object
>

oh, thanks!!!
i forgot about the “iter” object…..

best

kasper

#77495
May 20, 2006 at 10:42pm

turned out more complex as I thought, there might be an easier way…

Stefan

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 195 147 31 196617 t b l;
#P newex 213 378 39 196617 zl reg;
#P newex 271 360 39 196617 zl rev;
#P newex 271 334 38 196617 t l l;
#P newex 271 286 74 196617 route symbol;
#P message 213 422 176 196617;
#P newex 213 398 69 196617 prepend set;
#P newex 271 314 50 196617 zl join;
#P newex 216 174 38 196617 iter;
#N coll ;
#P newobj 271 264 50 196617 coll;
#P newex 271 238 38 196617 zl join;
#P newex 271 190 38 196617 t b l;
#N counter;
#X flags 0 0;
#P newobj 271 214 79 196617 counter;
#P newex 271 168 38 196617 iter;
#P newex 271 145 112 196617 t l 1 clear zlclear;
#P message 271 125 176 196617 apple orange kiwi banana coconut;
#P message 195 126 50 196617 1 3 5;
#P connect 16 0 15 0;
#P connect 16 1 8 0;
#P connect 0 0 16 0;
#P connect 15 0 10 0;
#P connect 14 0 15 1;
#P connect 13 0 14 0;
#P fasten 13 1 9 1 304 356 326 356 326 312 316 312;
#P connect 9 0 13 0;
#P fasten 2 3 9 0 378 309 276 309;
#P connect 2 1 4 2;
#P connect 1 0 2 0;
#P connect 2 0 3 0;
#P fasten 2 2 7 0 344 260 276 260;
#P connect 12 0 9 0;
#P fasten 12 1 9 0 340 305 276 305;
#P connect 7 0 12 0;
#P connect 10 0 11 0;
#P connect 8 0 7 0;
#P connect 6 0 7 0;
#P connect 4 0 6 0;
#P connect 5 1 6 1;
#P connect 5 0 4 0;
#P connect 3 0 5 0;
#P window clipboard copycount 17;


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#77496

You must be logged in to reply to this topic.