Revision: 10413 http://pure-data.svn.sourceforge.net/pure-data/?rev=10413&view=rev Author: fbar Date: 2008-12-02 12:50:54 +0000 (Tue, 02 Dec 2008)
Log Message: ----------- added Matt Barber's shellsort and list-swap
Added Paths: ----------- trunk/abstractions/footils/list-abs/list-shellsort-help.pd trunk/abstractions/footils/list-abs/list-shellsort.pd trunk/abstractions/footils/list-abs/list-swap-help.pd trunk/abstractions/footils/list-abs/list-swap.pd
Added: trunk/abstractions/footils/list-abs/list-shellsort-help.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-shellsort-help.pd (rev 0) +++ trunk/abstractions/footils/list-abs/list-shellsort-help.pd 2008-12-02 12:50:54 UTC (rev 10413) @@ -0,0 +1,17 @@ +#N canvas 258 96 687 438 10; +#X obj 74 139 list-shellsort; +#X msg 74 78 893 0 227 3 -221 3 88 42 8.78276e+06 -23447; +#X text 74 35 [list-shellsort] - sort a list of floats into ascending +order using a shellsort.; +#X text 295 103 <== symbols filtered out; +#X msg 110 105 dog 93 pig 9388 dog -38; +#X obj 294 164 list-sort; +#X text 290 142 also see:; +#X text 73 258 2008 Matt Barber; +#X obj 74 167 prepent set; +#X msg 74 191 -38 93 9388; +#X text 292 190 It's a bit slower , but does descending sorts.; +#X connect 0 0 8 0; +#X connect 1 0 0 0; +#X connect 4 0 0 0; +#X connect 8 0 9 0;
Added: trunk/abstractions/footils/list-abs/list-shellsort.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-shellsort.pd (rev 0) +++ trunk/abstractions/footils/list-abs/list-shellsort.pd 2008-12-02 12:50:54 UTC (rev 10413) @@ -0,0 +1,185 @@ +#N canvas 631 361 507 460 10; +#X obj 26 -25 inlet; +#X obj 26 296 outlet; +#N canvas 658 194 260 268 $0-gap-loop 0; +#X obj 96 66 / 2; +#X obj 96 89 int; +#X obj 34 122 until; +#X obj 34 49 t b f; +#X obj 148 105 sel 0; +#X obj 96 142 t f f; +#X obj 59 159 f; +#X obj 34 26 inlet; +#X obj 59 183 outlet; +#X connect 0 0 1 0; +#X connect 1 0 5 0; +#X connect 2 0 6 0; +#X connect 3 0 2 0; +#X connect 3 1 0 0; +#X connect 4 0 2 1; +#X connect 5 0 6 1; +#X connect 5 1 4 0; +#X connect 6 0 0 0; +#X connect 6 0 8 0; +#X connect 7 0 3 0; +#X restore 95 150 pd $0-gap-loop; +#X obj 49 65 list-len; +#N canvas 584 66 450 300 $0-increment-loop 0; +#X obj 40 26 inlet; +#X obj 163 27 inlet; +#X obj 40 83 until; +#X obj 40 53 t b f; +#X obj 99 100 f; +#X obj 130 101 + 1; +#X obj 136 157 moses; +#X obj 214 175 t b; +#X obj 136 193 outlet; +#X connect 0 0 3 0; +#X connect 1 0 6 1; +#X connect 2 0 4 0; +#X connect 3 0 2 0; +#X connect 3 1 4 1; +#X connect 4 0 5 0; +#X connect 4 0 6 0; +#X connect 5 0 4 1; +#X connect 6 0 8 0; +#X connect 6 1 7 0; +#X connect 7 0 2 1; +#X restore 95 195 pd $0-increment-loop; +#X obj 95 125 t f f; +#X obj 95 173 t f f; +#N canvas 147 172 582 718 $0-test-swap-loop 0; +#X obj 102 40 inlet; +#X obj 319 46 inlet; +#X obj 102 63 -; +#X obj 101 444 list-idx; +#X obj 162 444 list-idx; +#X obj 304 124 +; +#X obj 101 493 >; +#X obj 101 518 sel 0 1; +#X obj 302 534 f; +#X obj 335 534 f; +#X obj 267 563 list-swap; +#X obj 267 533 list; +#X obj 397 616 list; +#X obj 102 159 until; +#X obj 164 222 moses 0; +#X obj 164 197 f; +#X obj 197 197 -; +#X obj 102 84 t b f; +#X obj 164 265 t b b; +#X obj 191 287 s $0-stop-loop; +#X obj 165 126 r $0-stop-loop; +#X obj 164 307 s $0-bang-list; +#X obj 101 582 t b b; +#X obj 128 604 s $0-stop-loop; +#X obj 101 625 s $0-bang-list; +#X obj 397 546 r $0-bang-list; +#X obj 397 639 outlet; +#X obj 247 469 t b b; +#X obj 102 180 t b b; +#X obj 102 381 list; +#X obj 102 400 t a a; +#X obj 418 569 r $0-list-init; +#X obj 288 444 r $0-list-init; +#X obj 123 331 r $0-list-init; +#X text 316 25 gap; +#X obj 203 244 s $0-idx; +#X obj 331 85 r $0-idx; +#X obj 317 468 r $0-idx; +#X obj 146 382 r $0-idx; +#X obj 304 145 s $0-idx+gap; +#X obj 350 501 r $0-idx+gap; +#X obj 207 407 r $0-idx+gap; +#X obj 436 590 r $0-list-swap; +#X obj 267 591 s $0-list-swap; +#X obj 137 355 r $0-list-swap; +#X connect 0 0 2 0; +#X connect 1 0 2 1; +#X connect 1 0 5 1; +#X connect 1 0 16 1; +#X connect 2 0 17 0; +#X connect 3 0 6 0; +#X connect 4 0 6 1; +#X connect 5 0 39 0; +#X connect 6 0 7 0; +#X connect 7 0 22 0; +#X connect 7 1 27 0; +#X connect 7 2 22 0; +#X connect 8 0 10 1; +#X connect 9 0 10 2; +#X connect 10 0 11 1; +#X connect 10 0 43 0; +#X connect 11 0 10 0; +#X connect 12 0 26 0; +#X connect 13 0 28 0; +#X connect 14 0 18 0; +#X connect 14 1 35 0; +#X connect 15 0 16 0; +#X connect 15 0 14 0; +#X connect 16 0 15 1; +#X connect 17 0 13 0; +#X connect 17 1 15 1; +#X connect 18 0 21 0; +#X connect 18 1 19 0; +#X connect 20 0 13 1; +#X connect 22 0 24 0; +#X connect 22 1 23 0; +#X connect 25 0 12 0; +#X connect 27 0 11 0; +#X connect 27 1 9 0; +#X connect 27 1 8 0; +#X connect 28 0 29 0; +#X connect 28 1 15 0; +#X connect 29 0 30 0; +#X connect 30 0 3 0; +#X connect 30 1 4 0; +#X connect 31 0 12 1; +#X connect 32 0 11 1; +#X connect 33 0 29 1; +#X connect 36 0 5 0; +#X connect 37 0 8 1; +#X connect 38 0 3 1; +#X connect 40 0 9 1; +#X connect 41 0 4 1; +#X connect 42 0 12 1; +#X connect 44 0 29 1; +#X restore 95 221 pd $0-test-swap-loop; +#X obj 26 274 list; +#X obj 49 103 sel 0 1; +#X obj 72 43 s $0-list-init; +#X obj 99 242 r $0-list-init; +#X obj 26 22 t b a a; +#X obj 26 -1 list-filter; +#N canvas 0 0 677 293 $0-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 115 -1 pd $0-checknum; +#X text 46 343 2008 Matt Barber; +#X connect 0 0 13 0; +#X connect 2 0 6 0; +#X connect 3 0 9 0; +#X connect 4 0 7 0; +#X connect 5 0 2 0; +#X connect 5 1 4 1; +#X connect 6 0 4 0; +#X connect 6 1 7 1; +#X connect 7 0 8 1; +#X connect 8 0 1 0; +#X connect 9 2 5 0; +#X connect 11 0 8 1; +#X connect 12 0 8 0; +#X connect 12 1 3 0; +#X connect 12 2 10 0; +#X connect 13 0 12 0; +#X connect 13 1 14 0; +#X connect 14 0 13 1;
Added: trunk/abstractions/footils/list-abs/list-swap-help.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-swap-help.pd (rev 0) +++ trunk/abstractions/footils/list-abs/list-swap-help.pd 2008-12-02 12:50:54 UTC (rev 10413) @@ -0,0 +1,17 @@ +#N canvas 85 208 574 354 10; +#X msg 57 84 0 1 2 3 4 5 6 7 8 9 10 11; +#X floatatom 145 148 5 0 0 0 - - -; +#X floatatom 101 146 5 0 0 0 - - -; +#X obj 57 190 list-swap 2 5; +#X text 49 19 [list-swap] - swap two elements of a list at given indices. +Index values can be negative. If an index value is out of range , +the list is passed with no change.; +#X msg 75 114 list a b c d e f g h i j k; +#X obj 57 216 prepent set; +#X msg 57 241 0 1 5 3 4 2 6 7 8 9 10 11; +#X connect 0 0 3 0; +#X connect 1 0 3 2; +#X connect 2 0 3 1; +#X connect 3 0 6 0; +#X connect 5 0 3 0; +#X connect 6 0 7 0;
Added: trunk/abstractions/footils/list-abs/list-swap.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-swap.pd (rev 0) +++ trunk/abstractions/footils/list-abs/list-swap.pd 2008-12-02 12:50:54 UTC (rev 10413) @@ -0,0 +1,82 @@ +#N canvas 401 249 706 675 10; +#X obj 32 27 inlet; +#X obj 98 546 outlet; +#X obj 217 48 inlet; +#X obj 355 59 inlet; +#X obj 260 429 list-replace; +#X obj 113 400 list-idx; +#X obj 260 385 list-idx; +#X obj 196 101 f $1; +#X obj 334 105 f $2; +#X obj 113 446 list-replace; +#X obj 224 126 s $0-idx-1; +#X obj 358 165 s $0-idx-2; +#X obj 275 323 r $0-idx-1; +#X obj 158 333 r $0-idx-2; +#N canvas 229 564 450 300 $0-test-range 0; +#X obj 46 38 inlet; +#X obj 181 48 inlet; +#X obj 307 44 inlet; +#X obj 46 69 list-len; +#X obj 185 119 abs; +#X obj 323 121 abs; +#X obj 185 95 moses 0; +#X obj 323 96 moses 0; +#X obj 224 119 + 1; +#X obj 362 121 + 1; +#X obj 76 118 t f f; +#X obj 231 217 &&; +#X obj 326 171 >=; +#X obj 183 175 >=; +#X obj 235 252 outlet; +#X connect 0 0 3 0; +#X connect 1 0 6 0; +#X connect 2 0 7 0; +#X connect 3 0 10 0; +#X connect 4 0 13 1; +#X connect 5 0 12 1; +#X connect 6 0 4 0; +#X connect 6 1 8 0; +#X connect 7 0 5 0; +#X connect 7 1 9 0; +#X connect 8 0 13 1; +#X connect 9 0 12 1; +#X connect 10 0 13 0; +#X connect 10 1 12 0; +#X connect 11 0 14 0; +#X connect 12 0 11 1; +#X connect 13 0 11 0; +#X restore 150 170 pd $0-test-range; +#X obj 85 228 == 0; +#X obj 52 253 spigot; +#X obj 159 227 spigot; +#X obj 32 49 t a a b; +#X obj 162 250 t a a a; +#X connect 0 0 18 0; +#X connect 2 0 7 1; +#X connect 3 0 8 1; +#X connect 4 0 9 2; +#X connect 5 0 9 0; +#X connect 6 0 4 0; +#X connect 7 0 14 1; +#X connect 7 0 10 0; +#X connect 8 0 14 2; +#X connect 8 0 11 0; +#X connect 9 0 1 0; +#X connect 12 0 6 1; +#X connect 12 0 9 1; +#X connect 13 0 5 1; +#X connect 13 0 4 1; +#X connect 14 0 15 0; +#X connect 14 0 17 1; +#X connect 15 0 16 1; +#X connect 16 0 1 0; +#X connect 17 0 19 0; +#X connect 18 0 17 0; +#X connect 18 0 16 0; +#X connect 18 1 14 0; +#X connect 18 2 8 0; +#X connect 18 2 7 0; +#X connect 19 0 5 0; +#X connect 19 1 6 0; +#X connect 19 2 4 2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.