poker_validator v0.1.0 PokerValidator.Combination

Code taken from Comb library. Comb

Summary

Functions

Returns any combination of the elements in enum with exactly k elements. Repeated elements are handled intelligently.

Examples

iex> combinations([1, 2, 3], 2) |> Enum.to_list
[[1, 2], [1, 3], [2, 3]]
iex> combinations([1, 1, 2], 2) |> Enum.to_list
[[1, 1], [1, 2]]

Functions

combinations(enum, k)
combinations(Enum.t, integer) :: Enum.t

Returns any combination of the elements in enum with exactly k elements. Repeated elements are handled intelligently.

Examples

iex> combinations([1, 2, 3], 2) |> Enum.to_list
[[1, 2], [1, 3], [2, 3]]
iex> combinations([1, 1, 2], 2) |> Enum.to_list
[[1, 1], [1, 2]]