Forums > MaxMSP

using Max to run a list through a function

December 29, 2010 | 9:40 pm

I want to find some way to use Max to run lists through mathematical functions. For example, if I have f(x)=x^2, then I want a patch/object that turns {1,2,3,4,5,6} into {1,4,9,16,25,36}, or if I have g(x)=2x+1, then it would turn {1,2,3,4,5,6} into {3,5,7,9,11,13}. I might be able to come up with a patch, but I think my solution would be inelegant. I’m sure someone else must have encountered this issue before. Does anyone know of such a patch or object?


December 29, 2010 | 9:42 pm

vexpr!
aa


December 29, 2010 | 10:40 pm

also look at [zl] which you should know backwards and forwards for list manipulation. you could use [iter], run your original list through the function, then collect with [zl group] and bang out the result list when you’re done. or use [vexpr]. both ways here:

– Pasted Max Patch, click to expand. –

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