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
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
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:
[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.
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. p8rpp@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
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
Dear IOhannes, Roman, Jonathan,
thank you for your kind replies, and the examples you posted! It helped me quite a bit!
best, P
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
Unsubscribe
On Jan 24, 2014, at 5:08 PM, "Peter P." p8rpp@aol.com wrote:
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 zmoelnig@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
On 02/03/2014 06:11 PM, Jamie Hardt wrote:
Unsubscribe
i suggest you follow the instructions at the end of each list-posting:
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-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
fgmrdsa IOhannes