Hey guys,
I recently created a 0.1.0 version of my project Brute. Brute is a way of generating various combinations for a given character set. For example it can generate the the combinations of the set {a, b} of length five with the following:
iex> Brute.generic('ab', 5) |> Enum.to_list
["aaaaa", "baaaa", "abaaa", "bbaaa", "aabaa", "babaa", "abbaa", "bbbaa",
"aaaba", "baaba", "ababa", "bbaba", "aabba", "babba", "abbba", "bbbba",
"aaaab", "baaab", "abaab", "bbaab", "aabab", "babab", "abbab", "bbbab",
"aaabb", "baabb", "ababb", "bbabb", "aabbb", "babbb", "abbbb", "bbbbb"]
You can also provide ranges
iex> Brute.generic(?0..?4, 2) |> Enum.to_list
["00", "10", "20", "30", "40", "01", "11", "21", "31", "41", "02", "12", "22",
"32", "42", "03", "13", "23", "33", "43", "04", "14", "24", "34", "44"]
And if you provide a range for the âdepthâ parameter, it will give you a the sets ordered by depth
iex> Brute.generic('ab', 1..3) |> Enum.to_list
["a", "b", "aa", "ba", "ab", "bb", "aaa", "baa", "aba", "bba", "aab", "bab",
"abb", "bbb"]
I plan on creating a cache for these sets so for example, if a set of depth 10 is requested it might be sped up if sets 1-9 are already present in the cache.
Iâm sure there are tons of improvements I can make before a 1.0.0 release, so I would greatly appreciate any feedback!
edit: Woops forgot to add the actual link!