A System Of Patterns

This excercise will help you practice 'pattern matching' in very stripped down a to the point use cases.

Under the lib.a_system_of_patterns.ex, you will find a bunch of functions that you will need to implement or reimplement.

Excercise 1

Elixir is a functional programming language, so usually you don't want to use if statements even if they are supported by the language, pattern matching is usually a more powerful concept to deal with polymorphism.

In the first excercise, you need to reimplement the functions without using if statements, details in the comments.

Excercise 2

Pattern matching can be very handy in unpacking complex data strucutre such as tuples and lists to access their elements, in this excercise you are tasked to reimplement functions that unpack several types of data strucutres in order to print their elements in the console.

Excercise 3

Sometimes we might need to pattern match against the value of a variable and not to pattern match a value in a variable, in this excercise you are asked to figure out how.

Usefule links

Finally, here are some useful links: