Forums > MaxMSP

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

Dec 06 2009 | 1:19 am

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?



Dec 06 2009 | 2:10 am

try this

-- Pasted Max Patch, click to expand. --

Dec 06 2009 | 2:58 am

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!!!


Dec 06 2009 | 3:09 am

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


Dec 06 2009 | 3:49 am

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

-- Pasted Max Patch, click to expand. --

Dec 06 2009 | 3:57 am

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!!



Dec 06 2009 | 4:05 am

Is there a reason not to use listfunnel?

Dec 06 2009 | 4:31 am

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!

— Pasted Max Patch, click to expand. —

ooo chris? please do elaborate? :)

Dec 06 2009 | 4:45 am

-- Pasted Max Patch, click to expand. --

Dec 06 2009 | 5:12 am

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!!!


Dec 06 2009 | 5:34 am

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

-- Pasted Max Patch, click to expand. --

Dec 06 2009 | 5:54 am

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)

Dec 06 2009 | 6:14 am

:) 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?


Dec 06 2009 | 6:19 am

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

Dec 06 2009 | 6:33 am

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

Dec 06 2009 | 6:57 am

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!

Viewing 16 posts - 1 through 16 (of 16 total)

Forums > MaxMSP