[PD] [list length] counts unusual

Frank Barknecht fbar at footils.org
Mon Oct 30 23:04:23 CET 2006


Hallo,
Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:

> What I meant is that I can't think of good examples to test this  
> theory.  That's the next step, real world examples.

The existing length calculators I know for Pd count excluding the
list-selector and including "meta"-selectors: [length] from zexy, [zl
len] from Cyclone. See attached. 

Length in list-len.pd in the traditional way is calculated by
serializing the list using [list split 1] and [list append], which
drive a counter. I embedded it into the attached example as a
subpatch. Here the conversion of meta-messages to list-messages is
happening automatically as well, so this construct counts unlike [list
length] as well.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 204 162 527 386 10;
#X floatatom 46 235 5 0 0 0 - - -;
#X obj 46 202 zl len;
#X msg 96 77 list a b c;
#X msg 191 78 a b c;
#X obj 191 126 s TEST;
#X obj 46 180 r TEST;
#X floatatom 97 235 5 0 0 0 - - -;
#X obj 97 180 r TEST;
#X obj 97 202 length;
#X floatatom 173 336 5 0 0 0 - - -;
#X obj 173 281 r TEST;
#X obj 173 303 list length;
#X msg 280 78 bang;
#X msg 242 78 a;
#X floatatom 313 237 5 0 0 0 - - -;
#X obj 313 162 r TEST;
#X obj 313 204 list length;
#X obj 313 183 list;
#N canvas 276 256 511 446 list-len 0;
#X obj 126 70 inlet;
#X obj 161 209 + 1;
#X obj 82 172 b;
#X obj 116 249 f;
#X obj 116 276 outlet;
#X obj 148 183 1;
#X obj 132 211 f 1;
#X obj 206 213 0;
#X obj 126 104 t a b b;
#X text 37 37 list-len: calculate length of a list.;
#N canvas 0 0 586 413 drip 0;
#X obj 64 206 list split 1;
#X obj 64 123 until;
#X obj 64 181 list append;
#X obj 194 206 bang;
#X text 146 90 First store list \, then start the loop;
#X text 163 118 "until" bangs its output until told to stop by a "bang"
to its right inlet.;
#X text 182 160 Store the remaining list.;
#X text 239 205 third outlet of "split" tells us to stop.;
#X obj 64 243 outlet;
#X obj 64 57 inlet;
#X text 237 44 From list-help.pd;
#X obj 143 243 outlet;
#X obj 64 86 t b a;
#X connect 0 0 8 0;
#X connect 0 1 2 1;
#X connect 0 2 3 0;
#X connect 0 2 11 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 1 1;
#X connect 9 0 12 0;
#X connect 12 0 1 0;
#X connect 12 1 2 1;
#X restore 82 144 pd drip;
#X connect 0 0 8 0;
#X connect 1 0 6 1;
#X connect 2 0 6 0;
#X connect 3 0 4 0;
#X connect 5 0 6 1;
#X connect 6 0 1 0;
#X connect 6 0 3 1;
#X connect 7 0 3 1;
#X connect 8 0 10 0;
#X connect 8 1 5 0;
#X connect 8 2 7 0;
#X connect 10 0 2 0;
#X connect 10 1 3 0;
#X restore 147 202 pd list-len;
#X obj 147 180 r TEST;
#X floatatom 147 234 5 0 0 0 - - -;
#X msg 36 76 1 2 3;
#X connect 1 0 0 0;
#X connect 2 0 4 0;
#X connect 3 0 4 0;
#X connect 5 0 1 0;
#X connect 7 0 8 0;
#X connect 8 0 6 0;
#X connect 10 0 11 0;
#X connect 11 0 9 0;
#X connect 12 0 4 0;
#X connect 13 0 4 0;
#X connect 15 0 17 0;
#X connect 16 0 14 0;
#X connect 17 0 16 0;
#X connect 18 0 20 0;
#X connect 19 0 18 0;
#X connect 21 0 4 0;


More information about the Pd-list mailing list