Update of /cvsroot/pure-data/abstractions/footils/list-abs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30914
Modified Files: Tag: branch-v0-39-2-extended list-reduce-help.pd Log Message: Added example: Find closest element in list.
Index: list-reduce-help.pd =================================================================== RCS file: /cvsroot/pure-data/abstractions/footils/list-abs/list-reduce-help.pd,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** list-reduce-help.pd 28 May 2007 12:29:32 -0000 1.1.2.1 --- list-reduce-help.pd 18 Jun 2007 21:43:21 -0000 1.1.2.2 *************** *** 1,3 **** ! #N canvas 407 86 648 705 10; #X floatatom 128 311 5 0 0 0 - - -; #X msg 137 151 bang; --- 1,3 ---- ! #N canvas 407 86 619 794 10; #X floatatom 128 311 5 0 0 0 - - -; #X msg 137 151 bang; *************** *** 13,19 **** #X symbolatom 101 451 15 0 0 0 - - -; #X msg 196 420 $2-$1; ! #X obj 103 587 list-reduce; ! #X msg 103 560 1 2 3 4 5 6 7 8; ! #X msg 198 586 $2 $1; #N canvas 209 220 605 355 more-info 0; #X msg 84 101 bang; --- 13,19 ---- #X symbolatom 101 451 15 0 0 0 - - -; #X msg 196 420 $2-$1; ! #X obj 102 634 list-reduce; ! #X msg 102 607 1 2 3 4 5 6 7 8; ! #X msg 197 633 $2 $1; #N canvas 209 220 605 355 more-info 0; #X msg 84 101 bang; *************** *** 47,52 **** #X connect 14 0 9 0; #X connect 14 2 10 0; ! #X restore 354 422 pd more-info; ! #X obj 103 615 print REVERSE?; #X obj 101 421 list-reduce; #X text 93 64 [list-reduce] returns a single value constructed by calling --- 47,52 ---- #X connect 14 0 9 0; #X connect 14 2 10 0; ! #X restore 101 492 pd more-info; ! #X obj 102 662 print REVERSE?; #X obj 101 421 list-reduce; #X text 93 64 [list-reduce] returns a single value constructed by calling *************** *** 56,63 **** ; #X obj 107 273 list-reduce; ! #X text 100 485 It's important , that there will be only one element coming back in through the right inlet. Lists with more than one item will be shortened automatically to avoid stack overflows.; ! #X text 252 585 <-- two items == bad idea; #X msg 101 394 a b c d e; #X obj 329 275 list-reduce; --- 56,63 ---- ; #X obj 107 273 list-reduce; ! #X text 99 532 It's important , that there will be only one element coming back in through the right inlet. Lists with more than one item will be shortened automatically to avoid stack overflows.; ! #X text 251 632 <-- two items == bad idea; #X msg 101 394 a b c d e; #X obj 329 275 list-reduce; *************** *** 89,92 **** --- 89,135 ---- #X floatatom 329 326 5 0 0 3 min - -; #X obj 196 273 +; + #X obj 328 457 list-reduce; + #X floatatom 328 480 5 0 0 0 - - -; + #X msg 328 427 22 31 47 86; + #N canvas 0 0 701 458 compare-two 0; + #X obj 99 12 inlet; + #X obj 99 318 outlet; + #X obj 164 162 abs; + #X obj 99 161 abs; + #X obj 99 41 unpack f f; + #X obj 99 90 t a a; + #X obj 99 272 f; + #X obj 164 90 t a a; + #X obj 131 272 f; + #X obj 99 247 select 1 0; + #X text 178 276 send number with smaller distance back to reduce; + #X text 215 151 calculate distances; + #X obj 99 192 <; + #X obj 217 91 inlet; + #X obj 164 139 -; + #X obj 99 138 -; + #X connect 0 0 4 0; + #X connect 2 0 12 1; + #X connect 3 0 12 0; + #X connect 4 0 5 0; + #X connect 4 1 7 0; + #X connect 5 0 15 0; + #X connect 5 1 6 1; + #X connect 6 0 1 0; + #X connect 7 0 14 0; + #X connect 7 1 8 1; + #X connect 8 0 1 0; + #X connect 9 0 6 0; + #X connect 9 1 8 0; + #X connect 12 0 9 0; + #X connect 13 0 14 1; + #X connect 13 0 15 1; + #X connect 14 0 2 0; + #X connect 15 0 3 0; + #X restore 414 457 pd compare-two; + #X floatatom 507 438 5 0 0 0 - - -; + #X msg 507 415 45; + #X obj 507 392 loadbang; + #X text 325 390 Find closest element:; #X connect 1 0 20 0; #X connect 4 0 20 0; *************** *** 117,118 **** --- 160,168 ---- #X connect 31 0 29 1; #X connect 33 0 20 1; + #X connect 34 0 35 0; + #X connect 34 1 37 0; + #X connect 36 0 34 0; + #X connect 37 0 34 1; + #X connect 38 0 37 1; + #X connect 39 0 38 0; + #X connect 40 0 39 0;