Skip to content
FutureBlitz

    Install

    Import std.algo.combinatorics

    Combinations

    std.algo.combinatorics

    function

    @PanicsAtCaller Public Function Combinations<T>(items: T[], count: Int): CombinationIterator<T>

    Every choice of count of the array's elements, each in the array's order: Binomial(n, count) of them, none when count is more than n, and one empty one for 0. The array is copied. A negative count panics.

    Examples

    Local pairs: String[][] = []
    For pair In Combinations(["a", "b", "c"], 2)
        pairs.Add(pair)
    End For
    
    Expect(pairs == [["a", "b"], ["a", "c"], ["b", "c"]])

    std/algo/combinatorics.fb, line 192

    Report an issue with this page or with FutureBlitz on GitHub.