Combinatorics.jl icon indicating copy to clipboard operation
Combinatorics.jl copied to clipboard

integer_partitions should be deprecated in favour of partitions(n::Integer)

Open jessebett opened this issue 6 years ago • 0 comments

integer_partitions(n) should be deprecated in favour of partitions(n::Integer).

Additionally, partitions is not documented in the readme.

These functions currently do not behave the same: In the 0 case, both are broken, the partitions case discussed in #79 :

julia> integer_partitions(0)
0-element Array{Array{Int64,1},1}

julia> partitions(0)|>collect
1-element Array{Array{Int64,1},1}:
 #undef

but should return [[]]

For n>0 the results of integer_partitions is sorted opposite to partitions:

julia> collect(partitions(3))
3-element Array{Array{Int64,1},1}:
 [3]
 [2, 1]
 [1, 1, 1]

julia> integer_partitions(3)
3-element Array{Array{Int64,1},1}:
 [1, 1, 1]
 [2, 1]
 [3]

jessebett avatar Jul 11 '19 20:07 jessebett