[PD] An Iterator object

Kjetil S. Matheussen k.s.matheussen at notam02.no
Thu May 29 12:07:53 CEST 2003


On Wed, 28 May 2003, Michael McGonagle wrote:

> Hello all,
>
> I am looking for an object that will create any number of "embedded"
> iterators. The best analogy would be having a bunch of embedded "for"
> loops, like this:
>
>
> for (i = i_init; i < i_limit; i += i_inc)
>      for (j = j_init; j < j_limit; j += j_inc)
>          doSomething();
>
>
> I have created an abstraction that acts as a single loop, and I am using
> "until" to control the loops iterations. I would like to be able to not
> use "until" as this forces a restriction of making sure that all
> operations be performed within the same "time-interval" as all others. I
> would like to be able to send a single bang to the "top of the loop",
> and have it output the next set of iterators. For example
>
> [iterator 0 10 1 100 1000 100]
>
> banging on the iterator would produce the follow excerpt:
>
>       0 100
>       0 200
>       ...etc
>       0 1000
>       1 100
>       1 200
>       ...etc
>
> Is there an external that does something like this?
>

Doing things like this is nice with my k_cext external:
http://www.notam02.no/~kjetism/pd/bin/

The following patch does what you want:


#N canvas 56 333 589 504 10;
#X obj 73 309 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 10 256;
#X obj 297 311 nbx 5 14 -1e+37 1e+37 0 0 empty empty empty 0 -6 0 10
-262144 -1 -1 1000 256;
#X msg 59 36 bang;
#X obj 60 115 k_cext 7 2 0 0 10 1 100 1000 100 \; int i \, j \; for(i=I(1)
SC i<=I(2) SC i+=I(3)) BEGIN \; . for(j=I(4) SC j<=I(5) SC j+=I(6))
BEGIN \; . . O0(i) \; . . O1(j) \; . END \; END \;;
#X connect 2 0 3 0;
#X connect 3 0 0 0;
#X connect 3 1 1 0;




-- 





More information about the Pd-list mailing list