In Swift I have an array of indices that I want to use to permute an array of values (very easy to do in Matlab), but can't figure out a simple way of doing it (using a for-loop would be easy, but I'm looking for a more efficient method).
For example:
var indices = [1,0,2]
var values = ["A","B","C"]
var permute = values[indices]
// Hoping to print: permute = ["B","A","C"]