3 ms·
The linked doc seems to show only what python does as tuple unpacking, but as far as I know elixir can also do the matched unpacking. Based on [1] (which also g
by ketzu 6y ago
The linked doc seems to show only what python does as tuple unpacking, but as far as I know elixir can also do the matched unpacking. Based on [1] (which also gives a more matchy example), elixir just has a warning when not using the variable in the case block and you can denote that you want to match against the contents of the variable by prepending ^.
[1] https://www.reddit.com/r/programming/comments/lgqhmj/stack_overflow_users_rejoice_as_pattern_matching/gmtypn2/ https://www.reddit.com/r/programming/comments/lgqhmj/stack_o...