HELP! - List Management (adding index to list elements)

Mxll's icon

Elloh! im fairly new to Max5 so ...yeah :P

anyway! here's the deal.

I have a simple list of numbers that is constantly regenerated every now and then. I want to add an index for every number that is in that list so i can store in in a funbuff untill next regeneration.
(sometimes the list has only 5 numbers, sometimes 6 and most of the time 7)

So basicaly...lets say my current list is (1 2 5 6 7 9 11) i need to automatically add an index to each number in the list so that the list becomes (0 1, 1 2, 3 5, 4 6, 5 7, 6 9, 7 11).

I tried coll, zl pack unpack... but i just cant figure it out.

any ideas?

Thanks!!

-Mxll

Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

try this

Mxll's icon

Hey Terry!! thanks for quick reply (sorry i was taking a shower break :P)

seems to do what i want! (thumbs up!!)

i'll try to attach that to my patch....and i'll get back to ya!

... I don't want to sound needy but for learning purposes... could you explain just in a few words what's happening in there? if its too long don't bother :D i'll figure it out eventually.

thanks again!!!

-Mxll

Mxll's icon

Ok is seems to work.. in part.. but now i have to send that new list inside a funbuff so i can recall each index... wont i need a coma between each group? (1 1, 2 6, 3 8, ... etc) ?

sorry to bother so much!! ;D

-Mxll

Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

alright then, but you have to figure out how it works for yourself!

Mxll's icon

wow!! did you just come up with that! you are amazing!! :D

my head hurts just looking at it! hehe :) but i'll figure it out! i'll let you know how it goes in my patch!!

thanks!!!!!

-Mxll

Chris Muir's icon

Is there a reason not to use listfunnel?

Mxll's icon

ok there seems to be a problem when i regenerate a new list... it messes up the order... and 0's are repeated

its soooo close!!! :D

here check it out!

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

ooo chris? please do elaborate? :)

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.
Mxll's icon

Hey! Chris! listfunnel! the object is perfect! hehe! (sorry Terry! thnx alot for the effort! :D im saving those patches to study them :P )

I guess that solves that issue! :)

thanks guys!!!

-Mxll

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

And just so there's a counter version that works reliably:

Floating Point's icon

I must admit I don't think I've ever used listfunnel (or knew it existed).... and there's almost always an easier way (esp when it comes to my patching style)

Mxll's icon

:) style is important! and good for learning too! (using listfunnel won't teach me how its built :P)

...

i'll have another list problem in a minute! ...

actualy here it is! ...

I have 2 lists.

one with the "good" numbers and one with "bad" numbers. now i want to use these 2 lists as some sort of gate trigger system, so that when a number comes if its a number from the good list it can go through if its from the bad one it has to undergo a change until it becomes good ( +1, -1 or something like that.)

i tried with zl compare but i couldnt get it to work properly, it only gave me the first wrong number of the list and never the others...

any ideas?

-Mxll

Roman Thilenius's icon

[zl iter 1], [counter], [prepend set]
[prepend] ("set counter output")

Mxll's icon

hmm... i'll work on that... but im not sure what goes where .. ;S

Mxll's icon

oh! wait are you referring to my first problem or my second? because now that i worked with your suggestion it seems that your tip helps me put indexes to a list... right? ....

i guess i'll just start a new post :P

Thanks everyone!

keepsound's icon

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