JuliaMath / JuliaMath/Combinatorics.jl

partitions should only accept non-negative integers

Open
#80 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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.