We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Discussion on Naming Conventions for Elixir List Pattern
144
clicks
Source: reddit.com
A user, DerGsicht, expressed a preference for using a particular pattern to match nonempty lists in Elixir. They refer to a pattern, denoted by [_ | _], used to match a list with at least one element. Instead of the guard combination, the author finds this pattern more succinct and is curious if there's a descriptive, potentially official, name for it akin to the walrus operator ':=' in Python. A commenter, lpil, suggests simply referring to the pattern as 'any list of at least one element' and cautions against the use of joke names which might confuse others or require further explanation.
Related posts
© HashMerge 2024