JuliaMath / JuliaMath/Combinatorics.jl
partitions(0) does not return empty set
Open
- Dominant language
- Julia
- Stars
- 230
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
Currently
```
julia> partitions(0)|>collect
1-element Array{Any,1}:
#undef
```
This is unexpected because the [partition of the empty set is the empty set](https://en.wikipedia.org/wiki/Partition_of_a_set#Examples) so I would expect
```
patitions(0)|>collect == [[]]
```
This results in unexpected behviour here:
```
julia> [length(b) for b in partitions(1)]
1-element Array{Int64,1}:
1
julia> [length(b) for b in partitions(0)]
1-element Array{Int64,1}:
4492284592
# I expect this
julia> [length(b) for b in [[]]]
1-element Array{Int64,1}:
0
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.