Array and Proxys

I try to play 5 different proxys. Lets say they are:;;… and so on. Instead of writing all separately I want to do this faster:{arg i;

~((out++(i+1)).asSymbol).play} is not working. How can I do this?

Thanks in advance!

try (“out”++ (i+1) ).asSymbol )

the ProxySpace is an instance of Environment - read the help on Environment for more

Also envirGet and envirPut.


Thanks a lot! I was finding another solution too:{arg i; “;”.format(i+1).interpret};

FWIW – benchmarking the different approaches, I found that currentEnvironment[...] and (...).envirGet run at about the same speed, but interpret is about three times slower. That isn’t surprising: the first two are simple method calls that go directly to primitives; the third calls into the parser, builds a function, and evaluates the function (much heavier operations).

~a1 = 1; ~a2 = 2; ~a3 = 3; ~a4 = 4; ~a5 = 5;

bench { { |i| ("a" ++ (i%5 + 1)).asSymbol.envirGet } }

bench { { |i| currentEnvironment[("a" ++ (i%5 + 1)).asSymbol] } }

bench { { |i| ("~a" ++ (i%5 + 1)).interpret } }