Order new from indicies with an arbitrary order?

Hello, i wanted to use the Order.newFromIndices function for a midi mapping, however i’ve realized that when using the indicies argument, i get a problem when the indicies are not increasing in value.

let me give an example:

//works
~a = Order.newFromIndices(['b','c','a'],[1,2,3]);
~a[1];
~a[2];
~a[3];
//doesnt work
~b = Order.newFromIndices(['b','c','a'],[2,3,1]);
~b[1];
~b[2];
~b[3];

How do i get the second example to work? I hope my question became clear from this example.

Thank you very much!

how about:
g=Order();
[[\b,\c,\a],[2,1,3]].flop.do{|i| g.put(i[1],i[0])}
1 Like

Thank you very much, that did the trick! :smiley: