Revision: 10412 http://pure-data.svn.sourceforge.net/pure-data/?rev=10412&view=rev Author: fbar Date: 2008-12-02 12:25:31 +0000 (Tue, 02 Dec 2008)
Log Message: ----------- replace list-sort with Michal Seta's version
Modified Paths: -------------- trunk/abstractions/footils/list-abs/list-sort-help.pd trunk/abstractions/footils/list-abs/list-sort.pd
Modified: trunk/abstractions/footils/list-abs/list-sort-help.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-sort-help.pd 2008-12-02 10:34:21 UTC (rev 10411) +++ trunk/abstractions/footils/list-abs/list-sort-help.pd 2008-12-02 12:25:31 UTC (rev 10412) @@ -1,50 +1,37 @@ -#N canvas 420 190 744 496 10; -#X text 431 386 2008 Jack/RYBN; -#X msg 85 77 10; -#X text 188 249 Descendent; -#X text 175 227 Ascendent (default); -#X msg 85 340 44 39 27 10 10 8 5 -4 -14 -36; -#X text 123 76 <- generate a random list with 10 elements; -#X obj 85 311 prepent set; -#X msg 85 151 -36 5 44 8 39 -14 10 -4 27 10; -#X text 62 27 [list-sort] : sort a list of numbers. Elements of other -type (symbols , ...) are removed from the list.; -#N canvas 0 0 450 300 mklist 0; -#X obj 109 146 random 100; -#X obj 109 124 until; -#X msg 215 150 set; -#X msg 109 188 add2 $1; -#X obj 86 94 t b f b; -#X obj 109 167 - 50; -#X obj 86 63 inlet; -#X obj 86 237 outlet; -#X connect 0 0 5 0; -#X connect 1 0 0 0; -#X connect 2 0 7 0; -#X connect 3 0 7 0; -#X connect 4 0 7 0; -#X connect 4 1 1 0; -#X connect 4 2 2 0; -#X connect 5 0 3 0; -#X connect 6 0 4 0; -#X restore 85 116 pd mklist; -#X msg 371 338 44 39 27 10 10 8 5 -4 -14 -36; -#X obj 371 309 prepent set; -#X msg 145 228 asc; -#X msg 153 249 desc; -#X obj 466 192 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 +#N canvas 351 85 647 626 10; +#X msg 93 470 100 3 2; +#X obj 188 357 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 -1 -1 0; -#X obj 85 283 list-sort; -#X text 485 217 Arg can be "asc"/0 or "desc"/1; -#X obj 371 221 list-sort desc; -#X connect 1 0 9 0; -#X connect 6 0 4 0; -#X connect 7 0 15 0; -#X connect 7 0 17 0; -#X connect 9 0 7 0; -#X connect 11 0 10 0; -#X connect 12 0 15 1; -#X connect 13 0 15 1; -#X connect 14 0 17 1; -#X connect 15 0 6 0; -#X connect 17 0 11 0; +#X msg 232 357 asc; +#X msg 270 357 desc; +#X obj 35 11 list-sort; +#X obj 93 205 list-random 100 10; +#X obj 125 256 prepent set; +#X msg 93 179 bang; +#X obj 93 230 t b a; +#X msg 93 291 91 35 78 70 85 46 64 10 93 83; +#X text 279 324 non-floats are removed with a warning.; +#X msg 135 324 100 2 wrong type 3; +#X obj 93 441 prepent set; +#X text 55 523 2008 Michal Seta; +#X obj 93 396 list-sort desc; +#X text 66 80 Inlets: 1) list to sort; +#X text 66 134 Argument:; +#X text 121 98 2) direction: 0 or asc for ascending , 1 or desc for +descending; +#X text 137 134 <direction: 0/asc for ascending , 1/desc for descending> +; +#X text 65 40 Sort an incoming list of values in ascending or descending +order. Non-numbers are dropped.; +#X connect 1 0 14 1; +#X connect 2 0 14 1; +#X connect 3 0 14 1; +#X connect 5 0 8 0; +#X connect 6 0 9 0; +#X connect 7 0 5 0; +#X connect 8 0 9 0; +#X connect 8 1 6 0; +#X connect 9 0 14 0; +#X connect 11 0 14 0; +#X connect 12 0 0 0; +#X connect 14 0 12 0;
Modified: trunk/abstractions/footils/list-abs/list-sort.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-sort.pd 2008-12-02 10:34:21 UTC (rev 10411) +++ trunk/abstractions/footils/list-abs/list-sort.pd 2008-12-02 12:25:31 UTC (rev 10412) @@ -1,181 +1,193 @@ -#N canvas 395 80 787 477 10; -#X obj 55 40 inlet; -#N canvas 452 289 450 300 init 0; -#X obj 122 56 inlet; -#X obj 122 197 outlet; -#X obj 122 84 t a a b; -#X obj 161 111 s $0-init; -#X obj 141 142 list-len; -#X obj 141 167 s $0-len; -#X text 231 110 <- send bang to init some objects; -#X text 205 166 <- send the length of the list; -#X connect 0 0 2 0; -#X connect 2 0 1 0; -#X connect 2 1 4 0; -#X connect 2 2 3 0; -#X connect 4 0 5 0; -#X restore 55 70 pd init; -#X text 112 68 <- init; -#X obj 55 270 t a a; -#X obj 55 99 list-drip; -#X obj 136 210 r $0-init; -#X obj 212 210 r $0-sort; -#X obj 581 45 inlet; -#X obj 55 155 t f f; -#X obj 55 359 outlet; -#X obj 87 292 s $0-listtosort; -#N canvas 111 181 880 518 test 0; -#X obj 391 210 list-find; -#X msg 391 189 1; -#X obj 45 143 list-len; -#X obj 45 459 outlet; -#X obj 45 307 list; -#X obj 60 200 r $0-len; -#X obj 45 225 sel; -#X obj 45 165 t f f; -#X obj 66 277 r $0-sort; -#X obj 45 122 t a a; -#X obj 45 92 list-apply >; -#X obj 45 66 spigot 1; -#X obj 263 92 list-apply <; -#X obj 263 66 spigot 0; -#X obj 45 16 inlet; -#X obj 332 66 r $0-newelementtotest; -#X obj 114 66 r $0-newelementtotest; -#X text 351 91 <- the position of the new element must be between the -0 and 1 returned by [list-apply]; -#X text 468 208 <- find the first 1 in the list returned by [list-apply] -and return its position; -#X obj 181 426 s $0-sort; -#X text 769 468 2008 Jack/RYBN; -#X text 537 258 <- the 1 exist or not ? if it exist then sort the list -(red part) if not do nothing (green part); -#X obj 391 165 t b b a; -#X obj 491 259 == 0; -#X obj 451 259 != 0; -#X obj 174 294 cnv 15 200 125 empty empty empty 20 12 0 14 -258113 --66577 0; -#X obj 384 294 cnv 15 100 50 empty empty empty 20 12 0 14 -4034 -66577 -0; -#X obj 181 223 t b f; -#X obj 181 326 list-idx 2; -#X obj 181 267 list; -#X obj 181 202 - 1; -#X obj 181 371 list-insert; -#X obj 181 394 list-delete -1 1; -#X obj 181 302 spigot; -#X obj 202 246 r $0-init; -#X obj 264 246 r $0-listtosort; -#X obj 244 347 r $0-listtosort; -#X obj 391 301 spigot; -#X text 96 459 <- when all elements have been sent by [list-drip] , -a bang is sent to [list] to output the last list send by the red part -or green part; -#X obj 90 42 r $0-isasc; -#X obj 308 42 r $0-isdesc; +#N canvas 422 43 782 540 10; +#X obj 129 310 list split 1; +#X obj 57 266 list-len; +#X obj 163 331 list split 1; +#X obj 129 373 list append; +#X obj 57 347 list; +#X obj 57 287 > 0; +#X obj 150 472 outlet; +#X obj 57 308 sel 1 0; +#X obj 163 49 inlet; +#X text 55 513 2008 Michal Seta; +#X obj 233 393 list prepend; +#X obj 150 450 list append; +#X obj 452 140 loadbang; +#X obj 387 52 inlet; +#N canvas 0 0 552 424 mux 0; +#X obj 40 52 inlet; +#X obj 153 52 inlet; +#X obj 255 49 inlet; +#X obj 40 266 spigot 1; +#X obj 153 266 spigot; +#X obj 255 223 unpack 0 0; +#X msg 255 177 1 0; +#X msg 306 195 0 1; +#X obj 357 92 select 0; +#X obj 255 70 select asc desc; +#X obj 40 317 outlet; +#X connect 0 0 3 0; +#X connect 1 0 4 0; +#X connect 2 0 9 0; +#X connect 3 0 10 0; +#X connect 4 0 10 0; +#X connect 5 0 3 1; +#X connect 5 1 4 1; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 6 0; +#X connect 8 1 7 0; +#X connect 9 0 6 0; +#X connect 9 1 7 0; +#X connect 9 2 8 0; +#X restore 200 252 pd mux; +#X obj 387 201 list append $1; +#X obj 387 171 t b a; +#X obj 330 392 t a; +#X obj 163 163 t a a a a b; +#X obj 163 120 t a b; +#X text 292 283 [list-sort] sort an incoming list of numerical values +in an ascending or descending order; +#N canvas 294 34 842 735 minmaxpos 0; +#X obj 128 97 list-drip; +#X obj 128 120 route float; +#X obj 159 256 f; +#X obj 106 664 outlet; +#X obj 165 639 f; +#X obj 165 666 outlet; +#X obj 106 575 t b b; +#X obj 106 10 inlet; +#X obj 106 636 f; #N canvas 0 0 450 300 once 0; -#X obj 119 106 inlet; -#X obj 119 206 outlet; -#X obj 119 155 spigot 1; -#X obj 172 105 inlet; -#X msg 172 125 1; -#X obj 119 176 t a b; -#X msg 189 156 0; +#X obj 110 75 inlet; +#X obj 105 187 spigot 1; +#X obj 110 104 t b f; +#X msg 125 151 0; +#X msg 165 99 1; +#X obj 165 63 inlet; +#X obj 102 219 outlet; #X connect 0 0 2 0; -#X connect 2 0 5 0; -#X connect 3 0 4 0; -#X connect 4 0 2 1; -#X connect 5 0 1 0; -#X connect 5 1 6 0; -#X connect 6 0 2 1; -#X restore 391 258 pd once; -#X connect 0 0 41 0; -#X connect 0 1 23 0; -#X connect 0 1 24 0; -#X connect 1 0 0 0; -#X connect 2 0 7 0; -#X connect 4 0 3 0; -#X connect 5 0 6 1; -#X connect 6 0 4 0; -#X connect 7 0 6 0; -#X connect 7 1 30 0; -#X connect 8 0 4 1; -#X connect 9 0 2 0; -#X connect 9 1 22 0; -#X connect 10 0 9 0; -#X connect 11 0 10 0; -#X connect 12 0 9 0; -#X connect 13 0 12 0; -#X connect 14 0 11 0; -#X connect 14 0 13 0; -#X connect 15 0 12 2; -#X connect 16 0 10 2; -#X connect 22 0 1 0; -#X connect 22 1 41 1; -#X connect 22 2 0 1; -#X connect 23 0 37 1; -#X connect 24 0 33 1; -#X connect 27 0 29 0; -#X connect 27 1 28 1; -#X connect 28 0 31 0; -#X connect 29 0 33 0; -#X connect 29 0 37 0; -#X connect 30 0 27 0; -#X connect 31 0 32 0; -#X connect 32 0 19 0; -#X connect 33 0 28 0; -#X connect 34 0 29 1; -#X connect 35 0 29 1; -#X connect 36 0 31 2; -#X connect 37 0 19 0; -#X connect 39 0 11 1; -#X connect 40 0 13 1; -#X connect 41 0 31 1; -#X restore 55 331 pd test; -#X obj 87 181 s $0-newelementtotest; -#X text 489 344 2008 Jack/RYBN; -#X text 114 329 <- test position of the new value and sort it if needed +#X connect 1 0 6 0; +#X connect 2 0 3 0; +#X connect 2 1 1 0; +#X connect 3 0 1 1; +#X connect 4 0 1 1; +#X connect 5 0 4 0; +#X restore 262 183 pd once; +#X obj 275 258 f; +#X obj 244 257 max; +#X obj 128 256 min; +#X text 323 183 prime [min] and [max] with first item once; +#N canvas 0 0 450 300 count 0; +#X obj 120 148 f 0; +#X obj 148 149 + 1; +#X obj 163 100 0; +#X obj 117 24 inlet; +#X obj 119 176 outlet; +#X obj 181 25 inlet; +#X obj 114 47 b; +#X connect 0 0 1 0; +#X connect 0 0 4 0; +#X connect 1 0 0 1; +#X connect 2 0 0 1; +#X connect 3 0 6 0; +#X connect 5 0 2 0; +#X connect 6 0 0 0; +#X restore 168 371 pd count; +#X obj 128 470 change; +#X obj 244 472 change; +#X obj 128 527 f; +#X obj 244 525 f; +#X obj 128 495 b; +#X obj 244 496 b; +#X msg 429 356 set $1; +#X msg 601 357 0; +#X obj 106 30 t b a b b; +#X obj 128 150 t a a b a; +#X text 637 358 reset positions; +#X text 483 356 set change; +#X text 302 475 if min or max changes , store the new positions.; +#X text 227 24 output positions of min and max float in a list (zero-based) ; -#X text 125 97 <- send elements one after another; -#X text 152 245 <- place the new element from [list-drip] to the end -of the new sorted list; -#X obj 55 243 list prepend; -#X text 294 211 <- receive the new list sorted; -#X obj 55 128 route float; -#X obj 129 150 print Warning:_Only_float_lists_can_be_sorted; -#X obj 634 76 list append $1; -#X obj 634 100 list trim; -#X obj 634 52 loadbang; -#X obj 581 278 s $0-isasc; -#X obj 648 258 s $0-isdesc; -#X obj 581 230 unpack 0 0; -#X msg 581 197 1 0; -#X msg 628 196 0 1; -#X obj 581 132 route asc desc; -#X obj 676 153 route 0 1; #X connect 0 0 1 0; -#X connect 1 0 4 0; -#X connect 3 0 11 0; -#X connect 3 1 10 0; -#X connect 4 0 19 0; -#X connect 5 0 17 1; -#X connect 6 0 17 1; -#X connect 7 0 29 0; -#X connect 8 0 17 0; -#X connect 8 1 12 0; -#X connect 11 0 9 0; -#X connect 17 0 3 0; -#X connect 19 0 8 0; -#X connect 19 1 20 0; -#X connect 21 0 22 0; -#X connect 22 0 29 0; -#X connect 23 0 21 0; -#X connect 26 0 24 0; -#X connect 26 1 25 0; -#X connect 27 0 26 0; -#X connect 28 0 26 0; -#X connect 29 0 27 0; -#X connect 29 1 28 0; -#X connect 29 2 30 0; -#X connect 30 0 27 0; -#X connect 30 1 28 0; +#X connect 1 0 24 0; +#X connect 2 0 12 1; +#X connect 4 0 5 0; +#X connect 6 0 8 0; +#X connect 6 1 4 0; +#X connect 7 0 23 0; +#X connect 8 0 3 0; +#X connect 9 0 11 1; +#X connect 9 0 12 1; +#X connect 9 0 21 0; +#X connect 9 0 22 0; +#X connect 10 0 11 1; +#X connect 11 0 10 0; +#X connect 11 0 16 0; +#X connect 12 0 2 0; +#X connect 12 0 15 0; +#X connect 14 0 18 1; +#X connect 14 0 17 1; +#X connect 15 0 19 0; +#X connect 16 0 20 0; +#X connect 17 0 8 1; +#X connect 18 0 4 1; +#X connect 19 0 17 0; +#X connect 20 0 18 0; +#X connect 21 0 16 0; +#X connect 21 0 15 0; +#X connect 22 0 4 1; +#X connect 22 0 8 1; +#X connect 23 0 6 0; +#X connect 23 1 0 0; +#X connect 23 2 14 1; +#X connect 23 3 9 1; +#X connect 24 0 12 0; +#X connect 24 1 11 0; +#X connect 24 2 14 0; +#X connect 24 3 9 0; +#X restore 200 215 pd minmaxpos; +#X obj 163 86 list-filter; +#N canvas 0 0 677 293 checknum 0; +#X obj 131 95 route float; +#X msg 131 116 1; +#X obj 205 149 print; +#X msg 205 119 list-sort: Warning: dropped a non-number from list; +#X obj 131 70 inlet; +#X obj 131 149 outlet; +#X connect 0 0 1 0; +#X connect 0 1 3 0; +#X connect 1 0 5 0; +#X connect 3 0 2 0; +#X connect 4 0 0 0; +#X restore 252 86 pd checknum; +#X connect 0 0 3 0; +#X connect 0 1 2 0; +#X connect 1 0 5 0; +#X connect 2 0 10 0; +#X connect 2 1 3 1; +#X connect 3 0 4 1; +#X connect 4 0 18 0; +#X connect 5 0 7 0; +#X connect 7 0 4 0; +#X connect 7 1 11 0; +#X connect 8 0 22 0; +#X connect 10 0 11 1; +#X connect 10 0 17 0; +#X connect 11 0 6 0; +#X connect 12 0 15 0; +#X connect 13 0 16 0; +#X connect 14 0 0 1; +#X connect 15 0 14 2; +#X connect 16 0 15 0; +#X connect 16 1 15 1; +#X connect 17 0 10 1; +#X connect 18 0 1 0; +#X connect 18 1 0 0; +#X connect 18 2 21 0; +#X connect 19 0 18 0; +#X connect 19 1 10 1; +#X connect 21 0 14 0; +#X connect 21 1 14 1; +#X connect 22 0 19 0; +#X connect 22 1 23 0; +#X connect 23 0 22 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.