Other languages have lots and lots of convenience functions and magic commands and shortcuts built in to make writing code comfortable, at the expense of making reading more cryptic.
Go does not work the way. But you can take your loop and put it into a function, and then you have slice reordering without a loop, just like in R or Julia.
(To explain what I mean with making reading more cryptic: To me, x[idx] looks exactly like a simple index operation looks like in Go. If this syntax represents a complete restructuring of x based on an idx whose contents are expected to be a set of unique integers, then this is quite a lot of context information that is crammed into the expression x[idx]. I’d rather read this operation with a proper name, e.g. x.ReorderBy(idx).)
@christophberger
Thanks for the explanation.
Indeed, as @mje pointed out, for someone like me, who does not code in Go 24/7, it is a bit annoying to rewrite code