Skip to content

partitions should only accept non-negative integers #80

Open
@jessebett

Description

@jessebett

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions