Ensure `permute` stays within bounds

The `permute` function accepts a user defined function to rearrange the
elements of a `Vector`. However, the user had to ensure that the resulting
indices were within the bounds of the `Vector` size.

This fix introduces a modulo with the length of the `Vector` after the user
supplied function to wrap all indices into the `Vector` bounds.

If the range of the result of the user supplied function is within the
range of the length, then the modulo will not show up in the syntax tree.