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
On Sun, 2024-09-29 at 21:08 +0200, Peter P. wrote:
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.
Sounds like something from list-abs, though I wasn't able to find an abstraction for that specific task. I had a similar need recently and I made it a bit more generic now. I call it [list-delimit]:
https://netpd.org/~roman/tmp/list-delimit.zip
It iterates over all elements and switches the route when it hits the 'delimiter' element (e.g. 4 in your example).
Roman
I made a personalised abstraction a while ago that does exactly that (as far as i understood your problem). It splits lists according to specific symbols, floats and has also a flag to include the "split" element or not.
plus it has a practical "split at anything that is a symbol" mode.
The output happens all in the same [outlet] in my approach, but this can easily be changed
See attachment
Best
Oliver
Peter P. wrote:
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
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7EF2SASANM...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
[list-abs/list-find] finds the position of an element in a list. You can use this to split your list with [list split]. Here's an example:
[4 ( [1 2 3 4 5 6(
| |
[list-abs/list-find]
|
[t b f]
|
[list]
|
[list split]
| |
| [list split 1]
| |
[print left] [print right]
I hope the ASCII patch above is readable. The top [list split] sends its middle outlet to the bottom [list split 1], which in turn sends its middle outlet to [print right]. This way you'll get two lists printed, one by each [print], "1 2 3" and "5 6".
On 9/29/24 22:08, Peter P. wrote:
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
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7EF2SASANM...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
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
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7EF2SASANM...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
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
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7EF2SASANM...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/F5B2E6Z5XJ...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
Hello,
My two cents. It's been a while since I posted on this list ;) ++
Jack
Le mercredi 02 octobre 2024 à 14:30 +0200, Ingo Stock a écrit :
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
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/7EF2SASANM...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/F5B2E6Z5XJ...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/
pd-list@lists.iem.at - the Pure Data mailinglist https://lists.iem.at/hyperkitty/list/pd-list@lists.iem.at/message/VABVF4X5AN...
To unsubscribe send an email to pd-list-leave@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.iem.at/