Re: break a variable length list at a specific element

Ingo Stock <[email protected]>
Newsgroups gmane.comp.multimedia.puredata.general
Message-ID <[email protected]>
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/
list-split.pd (text/x-puredata, 984 B)
#N canvas 547 67 208 243 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 153 list store;
#X msg 83 107 append \$1;
#X obj 38 176 print;
#X msg 136 38 4;
#X obj 38 107 t b b;
#X obj 107 84 t b b;
#X msg 38 38 1 2 3 4 5 6;
#X obj 38 84 sel;
#X connect 0 0 8 0;
#X connect 0 1 6 0;
#X connect 1 0 3 0;
#X connect 2 0 1 0;
#X connect 4 0 8 1;
#X connect 5 0 1 1;
#X connect 5 1 1 0;
#X connect 6 0 1 1;
#X connect 6 1 1 0;
#X connect 7 0 0 0;
#X connect 8 0 5 0;
#X connect 8 1 2 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.