hard off wrote:
yeah , they're changing all the time.
but i will always have only for numbers. going to the beach today,
if you have a constant list length you can do it with abstractions. attached is an example for 4-element lists (but you can modify it to work with longer lists)
pd>=0.39 needed for the wonderful [list] object. (although it can be built without it it was far more fun to do it with it)
the indices are 0..(n-1) to be compatible with zexy's [sort].
mfga.sdr. IOhannes
#N canvas 238 433 420 362 10; #X obj 151 234 sort4; #X obj 181 265 print index; #X obj 151 291 print sorted; #X obj 151 174 pack 0 0 0 0; #X obj 151 200 t l l; #X obj 205 219 print unsorted; #X obj 230 145 random 100; #X obj 203 125 random 100; #X obj 151 145 random 100; #X obj 177 105 random 100; #X obj 151 78 t b b b b; #X msg 151 56 bang; #X connect 0 0 2 0; #X connect 0 1 1 0; #X connect 3 0 4 0; #X connect 4 0 0 0; #X connect 4 1 5 0; #X connect 6 0 3 3; #X connect 7 0 3 2; #X connect 8 0 3 0; #X connect 9 0 3 1; #X connect 10 0 8 0; #X connect 10 1 9 0; #X connect 10 2 7 0; #X connect 10 3 6 0; #X connect 11 0 10 0;
#N canvas 327 273 358 459 10; #X obj 55 109 inlet; #X obj 55 375 outlet; #X obj 55 132 unpack 0 0 0 0; #X obj 55 352 pack 0 0 0 0; #X obj 205 375 outlet; #X obj 205 352 pack 0 0 0 0; #X obj 55 313 unpack; #X obj 105 313 unpack; #X obj 155 313 unpack; #X obj 205 313 unpack; #X obj 55 205 sort_header; #X msg 55 156 $1 0; #X msg 127 177 $1 1; #X msg 145 156 $1 2; #X msg 217 177 $1 3; #X obj 145 205 sort_header; #X obj 127 231 sort_header; #X obj 55 255 sort_header; #X obj 145 257 sort_header; #X obj 127 285 sort_header; #X connect 0 0 2 0; #X connect 2 0 11 0; #X connect 2 1 12 0; #X connect 2 2 13 0; #X connect 2 3 14 0; #X connect 3 0 1 0; #X connect 5 0 4 0; #X connect 6 0 3 0; #X connect 6 1 5 0; #X connect 7 0 3 1; #X connect 7 1 5 1; #X connect 8 0 3 2; #X connect 8 1 5 2; #X connect 9 0 3 3; #X connect 9 1 5 3; #X connect 10 0 17 0; #X connect 10 1 16 0; #X connect 11 0 10 0; #X connect 12 0 10 1; #X connect 13 0 15 0; #X connect 14 0 15 1; #X connect 15 0 16 1; #X connect 15 1 18 1; #X connect 16 0 17 1; #X connect 16 1 18 0; #X connect 17 0 6 0; #X connect 17 1 19 0; #X connect 18 0 19 1; #X connect 18 1 9 0; #X connect 19 0 7 0; #X connect 19 1 8 0;
#N canvas 0 0 484 376 10; #X obj 131 85 inlet; #X obj 131 326 outlet; #X obj 276 326 outlet; #X obj 131 137 t f l; #X obj 221 85 inlet; #X obj 221 137 t f l; #X obj 131 177 >; #X obj 131 207 select 0 1; #X obj 131 239 t b b; #X obj 131 261 list; #X obj 166 261 list; #X obj 241 233 t b b; #X obj 241 255 list; #X obj 276 255 list; #X text 36 17 outputs the 2 incoming lists based on the "head"s (1st element) of the lists. the list with the greater head is output on the right side , the one with the lesser head goes to the left side. ; #X connect 0 0 3 0; #X connect 3 0 6 0; #X connect 3 1 9 1; #X connect 3 1 13 1; #X connect 4 0 5 0; #X connect 5 0 6 1; #X connect 5 1 10 1; #X connect 5 1 12 1; #X connect 6 0 7 0; #X connect 7 0 8 0; #X connect 7 1 11 0; #X connect 8 0 9 0; #X connect 8 1 10 0; #X connect 9 0 1 0; #X connect 10 0 2 0; #X connect 11 0 12 0; #X connect 11 1 13 0; #X connect 12 0 1 0; #X connect 13 0 2 0;