[PD] matching lists/arrays

Frank Barknecht fbar at footils.org
Tue May 2 17:04:29 CEST 2006


Hallo,
Tina Shah hat gesagt: // Tina Shah wrote:

> hello list, i have a list of lists - floats/arrays (x y z) using 
> datastructures.  i'd like to compare incoming data of 3 floats with my list 
> items (x1, y1, z1/x2, y2, z2, etc.).  if it matches one of the list items, 
> i'd like to perform an action specific to the list item it matches. i've 
> been trying to start this with the select object but it's not accepting a 
> list as an arguement, eventually i want to have all the list items as 
> arguements to compare with.  

Maybe attached patches can give you some inspiration. They require
pd-0.39 and list-drip/list-dripslow from my [list]-abs collection (see
http://footils.org/cms/show/46) 

What you get in the "==" example is a list of the results of the
comparison of each respective element in two lists. So "list 1 2 3" and
"list 1 2 0" would give "list 1 1 0" as a result.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 416 158 711 612 10;
#X obj 100 385 list prepend;
#X text 246 239 "Drip" (serialize) the list;
#X text 124 496 Final result is built here;
#X obj 78 81 inlet;
#X obj 77 530 outlet;
#X text 258 389 Repack the list;
#X obj 196 386 t a;
#X obj 206 187 inlet;
#X text 276 272 two inlets for the apply-operation;
#X obj 100 242 list-drip;
#X text 164 307 do \$1 with each element of second list;
#X obj 100 307 \$1;
#X obj 131 283 list-dripslow;
#X obj 181 215 list;
#X obj 100 262 t a b;
#X obj 78 150 t b a b b;
#X obj 77 499 list;
#X connect 0 0 6 0;
#X connect 0 0 16 1;
#X connect 3 0 15 0;
#X connect 6 0 0 1;
#X connect 7 0 13 1;
#X connect 9 0 14 0;
#X connect 11 0 0 0;
#X connect 12 0 11 1;
#X connect 13 0 12 1;
#X connect 14 0 11 0;
#X connect 14 1 12 0;
#X connect 15 0 16 0;
#X connect 15 1 9 0;
#X connect 15 2 0 1;
#X connect 15 3 13 0;
#X connect 16 0 4 0;
-------------- next part --------------
#N canvas 231 44 583 448 12;
#X msg 185 110 0.5 0.3 0.43;
#X msg 57 111 0.5 0.3 0.43;
#X msg 183 75 0.1 0.3 0.45;
#X obj 57 154 list-apply2 ==;
#X msg 61 74 0.1 0.3 0.45;
#X obj 57 206 print matchlist;
#X msg 453 110 0.5 0.3 0.43;
#X msg 325 111 0.5 0.3 0.43;
#X msg 451 75 0.1 0.3 0.45;
#X msg 329 74 0.1 0.3 0.45;
#X obj 325 206 print matchlist;
#X obj 325 154 list-apply2 *;
#X connect 0 0 3 1;
#X connect 1 0 3 0;
#X connect 2 0 3 1;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 6 0 11 1;
#X connect 7 0 11 0;
#X connect 8 0 11 1;
#X connect 9 0 11 0;
#X connect 11 0 10 0;


More information about the Pd-list mailing list