Combinatorics.jl
Combinatorics.jl copied to clipboard
partitions should only accept non-negative integers
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.