AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

AllParts broken ?

Open alanedelman opened this issue 4 years ago • 3 comments

ap =AllParts(5)
collect(ap)

7-element Vector{Vector{Int64}}:
 [5]
 [5]
 [5]
 [5]
 [5]
 [5]
 [5]

the Combinatorics package has partitions(5), so not sure why we need a new name or even a new data structure nice if it were just interoperable i suppose

alanedelman avatar Oct 31 '21 19:10 alanedelman

AllParts is a non-documented, internal, "inplace" iterator. The nonexported (don't know why) versions partitions/partitions! are the official functions. I guess we should have partitions(Vector{Int}, 5) to have a version returning elements of type Vector{Int}.

thofma avatar Nov 01 '21 16:11 thofma

This bahaviour is documented https://github.com/Nemocas/AbstractAlgebra.jl/blob/71fb7151f476a2440fdcd6a5c989992db81ceb60/src/generic/GenericTypes.jl#L121 but this documentation is not visible to the user. May it should be named AllParts! ?

tthsqe12 avatar Nov 22 '21 10:11 tthsqe12