permutation
permutation copied to clipboard
panic: reflect: slice index out of range
See:
http://play.golang.org/p/3oPYrSsY-R
Looks like after iterating the loop starting on line 187 of permutation.go that the 'i' variable is decremented until it becomes -1. It is then used again on line 193 that results in an exception. Will likely create a PR or fork this if the project is dead.

This took me ages to diagnose what was going wrong. This problem happens whenever the slice to permute contains two of the same value. Easy to spot if your inputs are integers, less simple if they are a more complex structure. No idea how to fix the code in question though