[PD] Multi dimensional [list]

Frank Barknecht fbar at footils.org
Sat Dec 30 23:38:25 CET 2006


Hallo,
Mathieu Bouchard hat gesagt: // Mathieu Bouchard wrote:

> On Sat, 30 Dec 2006, Frank Barknecht wrote:
> >Steffen hat gesagt: // Steffen wrote:
> >>That sounds nice since it will provide and easier solution to what
> >>I'm having a hard time building: A two-dimensional array "data-type"
> >>out of a list of floats with delimiter items to go with something
> >>like 2dtabread and 2dtabwrite abstractions. - Has anyone done that
> >>already?
> >I guess you will like the iemmatrix-externals.
> 
> The difference between matrices and lists-of-lists is that, in the former 
> case, the sublists need to be of fixed size.

Well, yes, that's of course true, and if it's an issue for a certain
application, then a more elaborate approach is needed. For example
something like [pool] can be handy here. 

Just for illustrating how data structures could be used to build
slightly more complex, uhm, data structures, I made a lists-of-lists
in attached useless example patch.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 425 34 699 423 10;
#N canvas 60 142 450 300 LOL 0;
#X obj 34 55 struct LOL float x array lol L;
#X restore 124 113 pd LOL;
#N canvas 147 477 450 300 LEL 0;
#X obj 100 65 struct LEL float y;
#X restore 124 59 pd LEL;
#N canvas 494 518 450 300 L 0;
#X obj 101 57 struct L array l LEL;
#X restore 124 86 pd L;
#X text 184 59 list element (a float);
#X text 184 89 list (list of LELs);
#X text 185 113 list of lists (list of Ls);
#N canvas 0 0 450 300 container 0;
#X restore 122 165 pd container;
#N canvas 0 0 749 530 create-LOL 0;
#X obj 284 246 append LOL x;
#X obj 284 277 pointer;
#X obj 364 225 pointer;
#X msg 364 199 traverse pd-container \, bang;
#X msg 284 224 0;
#X msg 265 70 bang;
#X obj 184 317 setsize LOL lol;
#X obj 265 100 t b b b b;
#X obj 132 361 element LOL lol;
#X obj 60 401 setsize L l;
#N canvas 0 0 450 300 count 0;
#X obj 81 47 inlet;
#X obj 80 107 until;
#X obj 83 75 t a b;
#X obj 128 108 0;
#X obj 78 133 f 0;
#X obj 106 132 + 1;
#X obj 79 167 outlet;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 1 0;
#X connect 2 1 3 0;
#X connect 3 0 4 1;
#X connect 4 0 5 0;
#X connect 4 0 6 0;
#X connect 5 0 4 1;
#X restore 60 310 pd count;
#X obj 60 284 t a a;
#X obj 60 334 t b a;
#X obj 60 260 f 4;
#X obj 60 368 f 4;
#X msg 583 200 clear;
#X obj 583 224 s pd-container;
#X text 543 154 clear container subpatch;
#X text 360 269 create LOL in container;
#X text 300 319 set how many elements "lol" in "LOL" should contain.
;
#X text 262 363 For each "lol" in "LOL" ...;
#X text 254 398 ... set size of contained list.;
#X obj 307 70 inlet;
#X obj 223 282 outlet;
#X text 140 260 also send pointer!;
#X connect 0 0 1 0;
#X connect 0 0 23 0;
#X connect 1 0 6 1;
#X connect 1 0 8 1;
#X connect 2 0 0 1;
#X connect 3 0 2 0;
#X connect 4 0 0 0;
#X connect 5 0 7 0;
#X connect 7 0 13 0;
#X connect 7 1 4 0;
#X connect 7 2 3 0;
#X connect 7 3 15 0;
#X connect 8 0 9 1;
#X connect 10 0 12 0;
#X connect 11 0 10 0;
#X connect 11 1 6 0;
#X connect 12 0 14 0;
#X connect 12 1 8 0;
#X connect 13 0 11 0;
#X connect 14 0 9 0;
#X connect 15 0 16 0;
#X connect 22 0 7 0;
#X restore 120 264 pd create-LOL;
#X text 228 159 container for LOL-scalars (will seem empty even if
full \, because no drawing instructions were used);
#X text 242 262 create new List Of Lists;
#N canvas 0 0 793 748 get-set-LOLs 0;
#X obj 249 300 element LOL lol;
#X obj 177 332 element L l;
#X floatatom 207 406 5 0 0 0 - - -;
#X floatatom 177 153 5 0 3 0 - - -;
#X floatatom 239 152 5 0 3 0 - - -;
#X obj 207 186 t b a;
#X floatatom 119 376 5 0 0 0 - - -;
#X obj 177 356 t a a;
#X msg 131 168 bang;
#X obj 207 379 get LEL y;
#X obj 119 406 set LEL y;
#X obj 177 87 hradio 15 1 0 4 empty empty empty 0 -8 0 10 -262144 -1
-1 1;
#X obj 239 87 vradio 15 1 0 4 empty empty empty 0 -8 0 10 -262144 -1
-1 0;
#X obj 334 118 inlet;
#X obj 177 224 pack 0 0 p;
#X text 333 99 pointer to LOL comes in here!;
#X obj 177 254 unpack 0 0 p;
#X msg 365 179 traverse pd-container \, next;
#X obj 365 204 pointer;
#X text 366 159 alternatively select pointer manually.;
#X text 175 54 select LEL element with ("x" \, "y");
#X connect 0 0 1 1;
#X connect 1 0 7 0;
#X connect 3 0 14 0;
#X connect 4 0 5 0;
#X connect 5 0 14 0;
#X connect 5 1 14 1;
#X connect 6 0 10 0;
#X connect 7 0 10 1;
#X connect 7 1 9 0;
#X connect 8 0 14 0;
#X connect 9 0 2 0;
#X connect 11 0 3 0;
#X connect 12 0 4 0;
#X connect 13 0 14 2;
#X connect 14 0 16 0;
#X connect 16 0 1 0;
#X connect 16 1 0 0;
#X connect 16 2 0 1;
#X connect 17 0 18 0;
#X connect 18 0 14 2;
#X restore 120 311 pd get-set-LOLs;
#X text 242 310 set or get internal list elements;
#X msg 120 241 click me!;
#X text 123 36 Data structures:;
#X connect 7 0 10 0;
#X connect 12 0 7 0;


More information about the Pd-list mailing list