Skip to content

Commit c00e546

Browse files
committed
return (phony) iterator to match API of Partition
1 parent c69b1d1 commit c00e546

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Combinatorics/EnumerativeCombinatorics/multipartitions.jl

+8-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ The algorithm is recursive and based on [`partitions(::IntegerUnion)`](@ref).
9090
9191
# Example
9292
```jldoctest
93-
julia> multipartitions(2,2)
93+
julia> MP = multipartitions(2,2);
94+
95+
julia> first(MP)
96+
Partition{Int64}[[], [2]]
97+
98+
julia> collect(multipartitions(2,2))
9499
5-element Vector{Multipartition{Int64}}:
95100
Partition{Int64}[[], [2]]
96101
Partition{Int64}[[], [1, 1]]
@@ -142,7 +147,8 @@ function multipartitions(n::T, r::IntegerUnion) where T<:IntegerUnion
142147
end
143148

144149
recP!(zeros(T,r), T(1), n)
145-
return MP
150+
return (x for x in MP)
151+
# return MP
146152
end
147153

148154

0 commit comments

Comments
 (0)