using Max to run a list through a function

Maxwell's icon

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?

andrea agostini's icon
seejayjames's icon
Max Patch
Copy patch and select New From Clipboard in Max.

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: