Page not found
+ +Sorry, but the page you were trying to get to, does not exist. You +may want to try searching this site using the sidebar or using our +API Reference page to find what +you were looking for.
+ + +diff --git a/doc/404.html b/doc/404.html new file mode 100644 index 0000000..c4edf26 --- /dev/null +++ b/doc/404.html @@ -0,0 +1,87 @@ + + +
+ + + + +Sorry, but the page you were trying to get to, does not exist. You +may want to try searching this site using the sidebar or using our +API Reference page to find what +you were looking for.
+ + +Provide a set of algorithms to generate combinations and permutations.
+For non-distinct elements in the source collection, simply pipe the result through Enum.uniq/1
to remove duplicates.
Generate k1..k2 combinations of based on given collection, where k2 > k1
+Generate all permutation of the collection, filtered by filter
function
Generate k1..k2 combinations of based on given collection, where k2 > k1.
+iex> 1..3 |> Combination.combine(1..2)
+[[1], [2], [3], [3, 2], [3, 1], [2, 1]]
+
+iex> 1..3 |> Combination.combine(2..3)
+[[3, 2], [3, 1], [2, 1], [3, 2, 1]]
+
+ permutate(Enum.t, (list -> as_boolean(term))) :: [list]
+
+ Generate all permutation of the collection, filtered by filter
function.
The filter
function filters the generated permutation before it is added
+to the result list. It returns true by default, thus allowing all permutations.
iex> 1..3 |> Combination.permutate
+[[1, 2, 3], [2, 1, 3], [3, 1, 2], [1, 3, 2], [2, 3, 1], [3, 2, 1]]
+
+iex> 1..3 |> Combination.permutate(fn p -> Enum.at(p, 0) == 1 end)
+[[1, 2, 3], [1, 3, 2]]
+
+ Provide a set of algorithms to generate combinations and permutations
+Copyright (c) 2016 Sean Tan Li Yang
+Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.
+ + +Elixir library to generate combinations and permutations from Enumerable
.
See Examples.
+API documentation is available at http://hexdocs.pm/combination
+To use Combination with your projects, edit your mix.exs
file and add it as a dependency:
defp deps do
+ [
+ {:combination, "~> x.x.x"},
+ ]
+end
+To generate combinations,
+iex> 1..3 |> Combination.combine(2)
+[[3, 2], [3, 1], [2, 1]]
+
+iex> 1..3 |> Combination.combine(1..2)
+[[1], [2], [3], [3, 2], [3, 1], [2, 1]]
+
+iex> 1..3 |> Combination.combine(2..3)
+[[3, 2], [3, 1], [2, 1], [3, 2, 1]]
+To generate permutations,
+iex> 1..3 |> Combination.permutate
+[[1, 2, 3], [2, 1, 3], [3, 1, 2], [1, 3, 2], [2, 3, 1], [3, 2, 1]]
+
+iex> 1..3 |> Combination.permutate(fn p -> Enum.at(p, 0) == 1 end)
+[[1, 2, 3], [1, 3, 2]]
+This software is licensed under MIT License.
+ + +