Revision: 10414 http://pure-data.svn.sourceforge.net/pure-data/?rev=10414&view=rev Author: fbar Date: 2008-12-02 14:39:12 +0000 (Tue, 02 Dec 2008)
Log Message: ----------- shellsort now can sort both directions
Modified Paths: -------------- trunk/abstractions/footils/list-abs/list-shellsort-help.pd trunk/abstractions/footils/list-abs/list-shellsort.pd
Modified: trunk/abstractions/footils/list-abs/list-shellsort-help.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-shellsort-help.pd 2008-12-02 12:50:54 UTC (rev 10413) +++ trunk/abstractions/footils/list-abs/list-shellsort-help.pd 2008-12-02 14:39:12 UTC (rev 10414) @@ -1,17 +1,39 @@ -#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; +#N canvas 258 96 681 655 10; +#X text 59 525 2008 Matt Barber; +#X msg 93 470 2 3 100; +#X obj 188 357 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -262144 +-1 -1 0; +#X msg 232 357 asc; +#X msg 270 357 desc; +#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 72 65 75 88 61 50 93 18 88 80; +#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 66 80 Inlets: 1) list to sort; +#X text 66 134 Argument:; +#X text 137 134 <direction: 0/asc for ascending , 1/desc for descending> +; +#X text 65 40 Sort a list of floats into ascending order using a Shell +sort. Non-numbers are dropped.; +#X obj 355 541 list-sort; +#X text 299 510 Alternative implementation available in:; +#X text 121 98 2) direction: 0 or asc for ascending , 1 or desc for +descending (default asc); +#X obj 35 11 list-shellsort; +#X obj 93 396 list-shellsort; +#X connect 2 0 21 1; +#X connect 3 0 21 1; +#X connect 4 0 21 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 21 0; +#X connect 11 0 21 0; +#X connect 12 0 1 0; +#X connect 21 0 12 0;
Modified: trunk/abstractions/footils/list-abs/list-shellsort.pd =================================================================== --- trunk/abstractions/footils/list-abs/list-shellsort.pd 2008-12-02 12:50:54 UTC (rev 10413) +++ trunk/abstractions/footils/list-abs/list-shellsort.pd 2008-12-02 14:39:12 UTC (rev 10414) @@ -1,4 +1,4 @@ -#N canvas 631 361 507 460 10; +#N canvas 631 361 591 470 10; #X obj 26 -25 inlet; #X obj 26 296 outlet; #N canvas 658 194 260 268 $0-gap-loop 0; @@ -48,20 +48,20 @@ #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; +#N canvas 147 172 708 735 $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 494 >; #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 332 564 f; +#X obj 365 564 f; +#X obj 297 593 list-swap; +#X obj 297 563 list; +#X obj 427 646 list; #X obj 102 159 until; #X obj 164 222 moses 0; #X obj 164 197 f; @@ -74,33 +74,73 @@ #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 427 576 r $0-bang-list; +#X obj 427 669 outlet; +#X obj 277 499 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 448 599 r $0-list-init; +#X obj 318 474 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 347 498 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 380 531 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 466 620 r $0-list-swap; +#X obj 297 621 s $0-list-swap; #X obj 137 355 r $0-list-swap; +#N canvas 468 185 584 529 swap? 0; +#X obj 40 52 inlet; +#X obj 153 52 inlet; +#X obj 361 50 inlet; +#X obj 40 272 spigot 1; +#X obj 256 272 spigot; +#X obj 361 224 unpack 0 0; +#X msg 361 178 1 0; +#X msg 412 196 0 1; +#X obj 463 93 select 0; +#X obj 361 71 select asc desc; +#X obj 40 437 outlet; +#X obj 153 437 outlet; +#X obj 256 300 swap; +#X obj 153 271 spigot 1; +#X obj 317 273 spigot; +#X connect 0 0 3 0; +#X connect 0 0 4 0; +#X connect 1 0 13 0; +#X connect 1 0 14 0; +#X connect 2 0 9 0; +#X connect 3 0 10 0; +#X connect 4 0 12 0; +#X connect 5 0 3 1; +#X connect 5 0 13 1; +#X connect 5 1 4 1; +#X connect 5 1 14 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 connect 12 0 10 0; +#X connect 12 1 11 0; +#X connect 13 0 11 0; +#X connect 14 0 12 1; +#X restore 101 471 pd swap?; +#X obj 164 470 r $0-direction; #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 3 0 45 0; +#X connect 4 0 45 1; #X connect 5 0 39 0; #X connect 6 0 7 0; #X connect 7 0 22 0; @@ -144,6 +184,9 @@ #X connect 41 0 4 1; #X connect 42 0 12 1; #X connect 44 0 29 1; +#X connect 45 0 6 0; +#X connect 45 1 6 1; +#X connect 46 0 45 2; #X restore 95 221 pd $0-test-swap-loop; #X obj 26 274 list; #X obj 49 103 sel 0 1; @@ -165,6 +208,11 @@ #X connect 4 0 0 0; #X restore 115 -1 pd $0-checknum; #X text 46 343 2008 Matt Barber; +#X obj 452 140 loadbang; +#X obj 387 52 inlet; +#X obj 387 201 list append $1; +#X obj 387 171 t b a; +#X obj 387 229 s $0-direction; #X connect 0 0 13 0; #X connect 2 0 6 0; #X connect 3 0 9 0; @@ -183,3 +231,8 @@ #X connect 13 0 12 0; #X connect 13 1 14 0; #X connect 14 0 13 1; +#X connect 16 0 18 0; +#X connect 17 0 19 0; +#X connect 18 0 20 0; +#X connect 19 0 18 0; +#X connect 19 1 18 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.