JuliaMath / JuliaMath/Combinatorics.jl

Combinations of a set of lengths

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

I thought this addition might be handy
```
combinations(a, T::AbstractVector{<:Integer}) = Iterators.flatten([combinations(a, t) for t in T])
julia> collect(combinations(1:5, 2:3))
20-element Vector{Vector{Int64}}:
[1, 2]
[1, 3]
[1, 4]
[1, 5]

[2, 3, 4]
[2, 3, 5]
[2, 4, 5]
[3, 4, 5]
```

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.