We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird code - is it a bug?. This reduce does not use the accumulator just returns the last element from the list, thus the List.wrap is necessary.
List.wrap( Enum.reduce(number_format.leading_digits_pattern, [], fn %{pattern: pattern}, _ -> pattern end) )
It should either be an empty list or [Enum.at(x, -1)] or I think Enum.map(x, &Map.get(&1, pattern))
[Enum.at(x, -1)]
Enum.map(x, &Map.get(&1, pattern))
Few examples from tests where the list contains multiple elements:
[ %{pattern: ~r/111|222|333/}, %{pattern: ~r/(?:111|222|333)1/}, %{pattern: ~r/(?:111|222|333)11/} ] [ %{pattern: ~r/222|333/}, %{pattern: ~r/2221|3332/}, %{pattern: ~r/22212|3332/}, %{pattern: ~r/222120|3332/} ] [%{pattern: ~r/[23]/}] [%{pattern: ~r/077/}] [%{pattern: ~r/[23]/}] [ %{pattern: ~r/1(?:0|1[19]|[69]9|5[458])|[57]0/}, %{pattern: ~r/1(?:0|1[19]|[69]9|5(?:44|59|8))|[57]0/} ] [ %{pattern: ~r/1(?:[169][2-8]|[78]|5[1-4])|[68]0|[3-6][1-9][2-9]/}, %{pattern: ~r/1(?:[169][2-8]|[78]|5(?:[1-3]|4[56]))|[68]0|[3-6][1-9][2-9]/} ]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Weird code - is it a bug?. This reduce does not use the accumulator just returns the last element from the list, thus the List.wrap is necessary.
It should either be an empty list or
[Enum.at(x, -1)]
or I thinkEnum.map(x, &Map.get(&1, pattern))
Few examples from tests where the list contains multiple elements:
The text was updated successfully, but these errors were encountered: