#N struct template2 float x float y float z float q float zz;
#N canvas 384 23 588 592 12;
#N canvas 427 343 493 354 stuff 0;
#X obj 241 225 pointer;
#X msg 76 71 bang;
#X obj 76 40 loadbang;
#X text 116 71 click here to re-initialize;
#X text 102 284 Explained later...;
#X obj 76 255 append template2 x y z q;
#X msg 332 143 \; pd-data2 clear;
#X msg 241 196 traverse pd-data2 \, bang;
#X obj 76 112 trigger bang bang bang, f 37;
#X msg 76 163 50 150 30 9 \, 100 100 -50 30 \, 200 90 70 900, f 15;
#X connect 0 0 5 4;
#X connect 1 0 8 0;
#X connect 2 0 1 0;
#X connect 7 0 0 0;
#X connect 8 0 9 0;
#X connect 8 1 7 0;
#X connect 8 2 6 0;
#X connect 9 0 5 0;
#X restore 464 380 pd stuff;
#X text 464 312 subpatches:;
#X obj 41 297 pointer;
#X msg 53 266 next;
#N canvas 973 95 314 247 data2 1;
#X scalar template2 50 150 30 9 0 \;;
#X scalar template2 100 100 -50 30 0 \;;
#X scalar template2 200 90 70 900 0 \;;
#X coords 0 247 1 246 0 0 0;
#X restore 464 335 pd data2;
#X obj 41 379 get template2 x y z q;
#X floatatom 41 408 5 0 0 0 - - - 0;
#X floatatom 89 408 5 0 0 0 - - - 0;
#X floatatom 137 408 5 0 0 0 - - - 0;
#X floatatom 185 408 5 0 0 0 - - - 0;
#X msg 41 236 traverse pd-data2;
#X text 268 392 and outputs the values of x \, y \, z \, and q., f 22;
#X obj 87 323 bng 19 250 50 0 empty empty empty 17 7 0 10 #dfdfdf #000000 #000000;
#X text 31 83 You can send the [pointer] object a "traverse" message to point it to the head of the list. The argument "pd-data2" indicates the Pd window named "data2." The head of the list means \, not the first scalar in the list \, but the position before the first scalar \, which is a valid pointer in Pd but has no data or template., f 74;
#X text 31 161 The "next" message tells the [pointer] object to go to the next scalar in the list and output it. If there are no more \, [pointer] outputs a bang at the right outlet., f 74;
#X obj 87 347 print end;
#X text 31 451 The [get] object takes a pointer \, checks that its template agrees with what [get] is expecting \, i.e. \, "template2" \, and if so outputs the values of x \, y \, z \, and q in the usual right to left order., f 74;
#X text 31 502 The pointer sent from [pointer] to [get] is an elementary Pd type on a level with "float" and "symbol"., f 74;
#N canvas 442 234 453 133 template2 0;
#X obj 40 54 filledpolygon 244 q 5 0 0 20 z 40 0;
#X obj 39 29 struct template2 float x float y float z float q;
#X text 38 87 The template for the scalars \, as in the last patch;
#X restore 464 358 pd template2;
#X text 174 235 <-- go to head of list (click first);
#X text 94 268 <-- output next item (click 4 times to reach the end);
#X text 101 295 <-- traverses and outputs pointers to scalars;
#X text 111 322 <-- bang when we reach the end of the list;
#X text 198 377 <-- this takes incoming pointers;
#X text 31 18 The simplest thing you can do with a collection of scalars (a list) is to traverse it and retrieve its field values. This is done using two objects \, [pointer] which does the traversal \, and [get] which \, given a pointer to a scalar \, extracts field values from it., f 74;
#X text 346 551 updated for Pd version 0.32;
#X connect 2 0 5 0;
#X connect 2 1 12 0;
#X connect 3 0 2 0;
#X connect 5 0 6 0;
#X connect 5 1 7 0;
#X connect 5 2 8 0;
#X connect 5 3 9 0;
#X connect 10 0 2 0;
#X connect 12 0 15 0;
