[PD] create list by header message

Jonathan Wilkes jancsika at yahoo.com
Thu Jan 23 20:47:24 CET 2014

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.)


On Thursday, January 23, 2014 1:46 PM, Peter P. <p8rpp at aol.com> wrote:

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


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 at iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20140123/5372e6bc/attachment-0001.htm>

More information about the Pd-list mailing list