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

Your Turn

  • Exercise: Protocols-3

    Collections that implement the Enumerable protocol define count, member?, and reduce functions. The Enum module uses these to implement methods such as each, filter, and map.

    Implement your own versions of each, filter, and map in terms of reduce.

  • Exercise: Protocols-4

    In many cases, inspect will return a valid Elixir literal for the value being inspected. Update the inspect function for structs so that it returns valid Elixir code to construct a new struct equal to the value being inspected.

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