Skip to content

Add an option to prohibit certain elements from grouping #2

@mbramson

Description

@mbramson

Add an additional option that accepts a some data structure (probably list of tuples) which allows users of the group/2 function to prohibit certain elements from being in the same group.

As an examples of the general gist:

iex> group([1,2,3,4], %{minimum: 2, maximum: 2, prohibited: [{1, [2]}]})
[[1, 3], [2,4]

iex> group([1,2,3,4], %{minimum: 2, maximum: 2, prohibited: [{1, [2]}, {3, [1, 2]}]})
:impossible

The second example is prohibited, because for 3 to not be in the same group as 1 and 2, 1 and 2 must be in the same group, which breaks the other prohibited constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions