JuliaMath / JuliaMath/Combinatorics.jl

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

Open
#81 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
230
Forks
62
PR merge metrics
No merged PRs in 30d

Description

`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]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.