In the previous post, we presented Variables In Elixir Pattern Matching. Today we explain how to make pattern matching on Elixir lists. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.
We pattern match Elixir list similar as Elixir tuples. We can use variables, pin operator, and anonymous variables.
As Elixir lists have one special operator,
| for extracting list
tail, we can also use this operator in List pattern matching.
Originally published at https://blog.tentamen.eu on January 8, 2021.