Add uniques M4L IDs to list

Dr Sogo's icon

Dr Sogo

9月 12 2024 | 6:37 午前

Hi everyone,

I’m working on a method to add IDs to a list, ensuring that each ID is unique and duplicates are filtered out. If an ID that is already in the list is selected, it will be ignored.

I’ve implemented a solution that appears to be working well for this purpose. However, I’d love to get feedback from the community. Would you approach this task differently, or do you have any suggestions for improvement?

Looking forward to your feedback!

Thanks!

Max Patch
Copy patch and select New From Clipboard in Max.

Sébastien Gay's icon

Sébastien Gay

9月 12 2024 | 7:15 午前

Not sure if I fully understood what you wanted, but if it is something like "adding a unique Id x or Idx in front of any new incoming number", I came-up with this :

Max Patch
Copy patch and select New From Clipboard in Max.

You may also have a look at [listfunnel] ...

schlam's icon

schlam

9月 12 2024 | 10:26 午前

Hello.

If too I understand well you can use [zl thin] to filter repetition

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

Source Audio

9月 12 2024 | 10:43 午前

If you receive ID for the first time, add it to the list AND output.

Received repetitions get filtered.

Is that what you want ?

if so, just store collected and thinned list and check it before new ID comes in.

if ID exists, ignore it, if it does not pass it.

Dr Sogo's icon

Dr Sogo

9月 12 2024 | 10:06 午後

Thank you for your answer! Yes, my goal is to filter out repeated IDs.
Schlam's suggestion of using [zl.thin] is a good approach. However, I'm not a big fan of using [prepend append] connected to a message. Is there another method that could achieve a similar result?

Here another version based on Schlam's patch, but without using [prepend append] connected to a message. It works, but if you choose an ID that's already in the list, obviously it change its position. I'd prefer it to stay in the same place.

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

Source Audio

9月 13 2024 | 8:27 午前

here example using coll.

I don't use live GUI elements,

if you use live.menu, insert fromsymbol.

Max Patch
Copy patch and select New From Clipboard in Max.

Dr Sogo's icon

Dr Sogo

9月 13 2024 | 4:38 午後

Hey man! I love that solution!

I've just adapted it to my needs :)

Max Patch
Copy patch and select New From Clipboard in Max.