JuliaMath / JuliaMath/Combinatorics.jl
partitions should only accept non-negative integers
- Dominant language
- Julia
- Stars
- 230
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
`partitions(-1)` should produce an error when it is constructed:
```
# error here
julia> partitions(-1)
Combinatorics.IntegerPartitions(-1)
julia> partitions(-1)|>collect
ERROR: ArgumentError: destination has fewer elements than required
Stacktrace:
[1] copyto!(::Array{Any,1}, ::Combinatorics.IntegerPartitions) at ./abstractarray.jl:669
[2] _collect at ./array.jl:550 [inlined]
[3] collect at ./array.jl:544 [inlined]
[4] |>(::Combinatorics.IntegerPartitions, ::typeof(collect)) at ./operators.jl:813
[5] top-level scope at none:0
```
Noticed by Harmen Stoppels.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.