From the course: Elixir 101: Essential Functional Programming Techniques

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Maps

Maps

- [Instructor] We will use this video to explore the extremely useful data type, maps. Knowing how to work with maps gives you access to the most elegant and powerful aspects of Elixir, like pattern matching and reducers. In 2015, the creator of the Elixir programming language wrote this blog post. You can find a link to it in the resources section of the course Read Me. The key points for us are the concepts of a collection and a reducer. In designing collections, Elixir borrowed from Haskell, Clojure, and Scala. Collections are supported by the enumerable protocol, which is an implementation of an abstraction called "reducees." In contrast to an iterator, like a for loop in other languages, reducers send computations to the collection so the collection can apply the computation on itself. Instead of a next function, reducers reduce. Here's an example from the blog post. Don't worry if this doesn't make sense just yet,…

Contents