Re: [PD] create list by header message

2014-01-24 Thread IOhannes m zmölnig
On 01/23/2014 07:43 PM, Peter P. wrote:
 Hi,
 
 this might be totally simple, but I am wondering what is the most
 elegant way of creating a list out of individual messages
 
 12
 23
 34
 45
 
 meaning a list which holds four items, and which is always created at
 the number '12', and sent out at the nu,ner '45', yielding:
 
 list 12 23 34 45
 
 so some kind of parallelization depending on a header value (12).
 

i found [list prepend] to be the easiest accumulator to read (though
performance-wise it's less optimal once it comes to **large** lists)

adding the logic to convert your starting and stopping delimiters to
reset/output the list, is left as an exercise for the user.

fgmadrs
IOhannes

#N canvas 459 190 604 364 10;
#X msg 230 92 12 \, 23 \, 34 \, 45;
#X obj 149 209 list prepend;
#X obj 230 161 list prepend;
#X obj 230 183 t a a;
#X obj 149 231 print;
#X obj 311 136 t b b;
#X msg 57 86 bang;
#X obj 57 108 t b b;
#X text 226 66 data to accumulate;
#X text 44 64 output and reset;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 3 0;
#X connect 3 0 1 1;
#X connect 3 1 2 1;
#X connect 5 0 2 1;
#X connect 5 1 1 1;
#X connect 6 0 7 0;
#X connect 7 0 5 0;
#X connect 7 1 1 0;


signature.asc
Description: OpenPGP digital signature
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] create list by header message

2014-01-24 Thread Peter P.
Dear IOhannes, Roman, Jonathan,

thank you for your kind replies, and the examples you posted! It
helped me quite a bit!

best, P

* IOhannes m zmölnig zmoel...@iem.at [2014-01-24 10:48]:
 On 01/23/2014 07:43 PM, Peter P. wrote:
  Hi,
  
  this might be totally simple, but I am wondering what is the most
  elegant way of creating a list out of individual messages
  
  12
  23
  34
  45
  
  meaning a list which holds four items, and which is always created at
  the number '12', and sent out at the nu,ner '45', yielding:
  
  list 12 23 34 45
  
  so some kind of parallelization depending on a header value (12).
  
 
 i found [list prepend] to be the easiest accumulator to read (though
 performance-wise it's less optimal once it comes to **large** lists)
 
 adding the logic to convert your starting and stopping delimiters to
 reset/output the list, is left as an exercise for the user.
 
 fgmadrs
 IOhannes
 

 #N canvas 459 190 604 364 10;
 #X msg 230 92 12 \, 23 \, 34 \, 45;
 #X obj 149 209 list prepend;
 #X obj 230 161 list prepend;
 #X obj 230 183 t a a;
 #X obj 149 231 print;
 #X obj 311 136 t b b;
 #X msg 57 86 bang;
 #X obj 57 108 t b b;
 #X text 226 66 data to accumulate;
 #X text 44 64 output and reset;
 #X connect 0 0 2 0;
 #X connect 1 0 4 0;
 #X connect 2 0 3 0;
 #X connect 3 0 1 1;
 #X connect 3 1 2 1;
 #X connect 5 0 2 1;
 #X connect 5 1 1 1;
 #X connect 6 0 7 0;
 #X connect 7 0 5 0;
 #X connect 7 1 1 0;




 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] create list by header message

2014-01-23 Thread Peter P.
Hi,

this might be totally simple, but I am wondering what is the most
elegant way of creating a list out of individual messages

12
23
34
45

meaning a list which holds four items, and which is always created at
the number '12', and sent out at the nu,ner '45', yielding:

list 12 23 34 45

so some kind of parallelization depending on a header value (12).

thanks for any pointers
best, P

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] create list by header message

2014-01-23 Thread Jonathan Wilkes
Do you want every list to have exactly four elements, or do you want '45' to 
always be the last element?

Either way you have two idioms you can use to build the list:

1) [list prepend] with its output feeding back into its right inlet.  You 
collect this into the right inlet of another [list] object, and bang it out 
when you've got the entire list (and bang the right inlet of [list prepend] to 
reset it.  The benefit is that it's easy to patch; the drawback is that it's 
slow because you're copying the list twice for each element.

2) message box, using the set, add2, and bang methods.  Use set to clear 
the message box, and add2 $1 to add each incoming float to the message.  Then 
send a bang when you want to output your list.  The benefit is that it's fast.  
The drawback is that if you screw up and build, say, a million element list 
while the canvas containing the message box is visible Pd, will probably freeze.

Then you just need a [moses], [select], or other branching object above one of 
the two options above to output and reset the list.  (Plus a counter if you 
want four-element lists.)

-Jonathan




On Thursday, January 23, 2014 1:46 PM, Peter P. p8...@aol.com wrote:
 
Hi,

this might be totally simple, but I am wondering what is the most
elegant way of creating a list out of individual messages

12
23
34
45

meaning a list which holds four items, and which is always created at
the number '12', and sent out at the nu,ner '45', yielding:

list 12 23 34 45

so some kind of parallelization depending on a header value (12).

thanks for any pointers
best, P

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] create list by header message

2014-01-23 Thread Roman Haefeli
On Don, 2014-01-23 at 19:43 +0100, Peter P. wrote:
 Hi,
 
 this might be totally simple, but I am wondering what is the most
 elegant way of creating a list out of individual messages
 
 12
 23
 34
 45
 
 meaning a list which holds four items, and which is always created at
 the number '12', and sent out at the nu,ner '45', yielding:
 
 list 12 23 34 45
 
 so some kind of parallelization depending on a header value (12).

Something like this? (see attachment)

Roman

#N canvas 43 101 385 424 10;
#X msg 20 315;
#X msg 20 107 12;
#X msg 20 258 add2 \$1;
#X obj 20 143 t a b;
#X msg 47 167 1;
#X obj 71 230 spigot 0;
#X obj 20 81 sel 12 45;
#X msg 129 122 45;
#X obj 129 156 t b a b;
#X msg 168 182 0;
#X msg 129 261 bang \, set;
#X obj 20 372 print;
#X floatatom 20 23 5 0 0 0 - - -, f 5;
#X msg 76 20 12 \, 23 \, 34 \, 45;
#X connect 0 0 11 0;
#X connect 1 0 3 0;
#X connect 2 0 0 0;
#X connect 3 0 2 0;
#X connect 3 1 4 0;
#X connect 4 0 5 1;
#X connect 5 0 2 0;
#X connect 6 0 1 0;
#X connect 6 1 7 0;
#X connect 6 2 5 0;
#X connect 7 0 8 0;
#X connect 8 0 10 0;
#X connect 8 1 2 0;
#X connect 8 2 9 0;
#X connect 9 0 5 1;
#X connect 10 0 0 0;
#X connect 12 0 6 0;
#X connect 13 0 6 0;
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list