Re: break a variable length list at a specific element

Ingo Stock <[email protected]>
Newsgroups gmane.comp.multimedia.puredata.general
Message-ID <[email protected]>
With symbol support.


Am 02.10.24 um 12:58 schrieb Ingo Stock:
> A simple approach.
>
>
> Am 29.09.24 um 21:08 schrieb Peter P.:
>> Hi list,
>>
>> I am having lists with a variable number of items and I want to break 
>> them
>> up two lists dependent on the presence of a specific item. I can't 
>> seem to
>> understand how to do it though. Here's a quick example of what I mean:
>>
>> 1 2 3 4 5 6
>> look for the number 4 and output two lists (at separate outlets) which
>> are before and after that number 4, giving:
>> 1 2 3
>> and
>> 5 6
>> respectively
>>
>> I'd need the solution to work for lists of other lengths as well, i.e.
>> 55 66 77 88 4 102 -33
>> should be broken up into
>> 55 66 77 88
>> and 102 -33
>> alike.
>>
>> I tried [route] and [list] objects but can't get them to do what I want.
>>
>> thanks!
>> P
>>
>> ---
>> [email protected] - the Pure Data mailinglist
>> https://lists.iem.at/hyperkitty/list/[email protected]/message/7EF2SASANM67WTX766GIKCN5OIR64PXN/ 
>>
>>
>> To unsubscribe send an email to [email protected] mailing list
>> UNSUBSCRIBE and account-management -> https://lists.iem.at/
>>
>
> ---
> [email protected] - the Pure Data mailinglist
> https://lists.iem.at/hyperkitty/list/[email protected]/message/F5B2E6Z5XJPVE3YSBI3ZTZITQRUSPYBX/
>
> To unsubscribe send an email to [email protected] mailing list
> UNSUBSCRIBE and account-management -> https://lists.iem.at/

---
[email protected] - the Pure Data mailinglist
https://lists.iem.at/hyperkitty/list/[email protected]/message/VABVF4X5ANT3EBHVRSBDQ52OTPGNMZMQ/

To unsubscribe send an email to [email protected] mailing list
UNSUBSCRIBE and account-management -> https://lists.iem.at/
list-split2.pd (text/x-puredata, 1.4 KB)
#N canvas 547 164 311 360 10;
#N canvas 750 206 194 241 list-drip 0;
#X obj 37 37 inlet;
#X obj 37 152 list store;
#X obj 37 83 until;
#X obj 37 106 f;
#X obj 67 106 + 1;
#X msg 37 129 get \$1 1;
#X obj 78 84 0;
#X obj 37 175 outlet;
#X obj 94 175 outlet;
#X obj 37 60 t b b a;
#X connect 0 0 9 0;
#X connect 1 0 7 0;
#X connect 1 1 8 0;
#X connect 1 1 2 1;
#X connect 2 0 3 0;
#X connect 3 0 5 0;
#X connect 3 0 4 0;
#X connect 4 0 3 1;
#X connect 5 0 1 0;
#X connect 6 0 3 1;
#X connect 9 0 2 0;
#X connect 9 1 6 0;
#X connect 9 2 1 1;
#X restore 38 61 pd list-drip;
#X obj 38 268 list store;
#X msg 83 222 append \$1;
#X obj 38 291 print;
#X msg 156 38 4;
#X obj 38 222 t b b;
#X obj 38 130 list prepend 0;
#X obj 38 153 route 0 1;
#X msg 186 38 a;
#X msg 38 38 1 2 3 a 4 5 6;
#X obj 156 84 route float symbol;
#X msg 156 107 0;
#X msg 208 107 1;
#X obj 38 176 route;
#X obj 83 176 route -;
#X obj 83 199 list;
#X obj 156 61 list;
#X connect 0 0 6 0;
#X connect 0 1 5 0;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
#X connect 4 0 16 0;
#X connect 5 0 1 1;
#X connect 5 1 1 0;
#X connect 6 0 7 0;
#X connect 7 0 13 0;
#X connect 7 1 14 0;
#X connect 8 0 16 0;
#X connect 9 0 0 0;
#X connect 10 0 11 0;
#X connect 10 0 13 1;
#X connect 10 1 12 0;
#X connect 10 1 14 1;
#X connect 11 0 6 1;
#X connect 12 0 6 1;
#X connect 13 0 5 0;
#X connect 13 1 15 0;
#X connect 14 0 5 0;
#X connect 14 1 15 0;
#X connect 15 0 2 0;
#X connect 16 0 10 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.