I saw a comment in combinatorics.jl that this stuff is being moved over there so I'll check out if that's the same implementation. I think my use of the function is more likely what people want when thinking: "oh, I want all the permutations of this array"
On Thursday, November 19, 2015 at 4:12:35 PM UTC-5, Stefan Karpinski wrote: > > That's definitely more memory efficient, but not much more computationally > efficient. There's probably a much cleverer way to compute the unique > permutations of a set of values that contain repetitions. It's arguable > that this is what permutations ought to do in the first place. > > On Thu, Nov 19, 2015 at 4:06 PM, David P. Sanders <dpsa...@gmail.com > <javascript:>> wrote: > >> >> >> El jueves, 19 de noviembre de 2015, 14:45:41 (UTC-6), Ratan Sur escribió: >>> >>> I want to get all the unique permutations of an array of a certain >>> length and this is the only way I currently know how to do it in one line. >>> Is there a builtin function for this? >>> >>> julia> unique(collect(permutations([1;0;0;0;1]))) >>> 10-element Array{Array{Int64,1},1}: >>> [1,0,0,0,1] >>> [1,0,0,1,0] >>> [1,0,1,0,0] >>> [1,1,0,0,0] >>> [0,1,0,0,1] >>> [0,1,0,1,0] >>> [0,1,1,0,0] >>> [0,0,1,0,1] >>> [0,0,1,1,0] >>> [0,0,0,1,1] >>> >>> >> It turns out that the following works: >> >> unique(permutations([1, 0, 0, 0, 1])) >> >> >> > >