O'Reilly logo

Programming Elixir by Dave Thomas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9An Aside—What Are Types?

The preceding two chapters described the basics of lists and dictionaries. But you may have noticed that, although I talked about them as types, I didn’t really say what I meant.

The first thing to understand is that the primitive data types are not necessarily the same as the types they can represent.

For example, a primitive Elixir list is just an ordered list of values. We can use the […] literal to create a list, and the | operator to deconstruct and build lists.

Then there’s another layer. Elixir has the List module, which provides a set of functions that operate on lists. Often these functions simply use recursion and the | operator to add this extra functionality.

In my mind, there’s a difference between ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required