The Code in This Book

Most of the code snippets come from full-length, running examples that you can download.[2] To help you find your way, if a code listing in this book can be found in the download, there’ll be a bar above the snippet (just like the one here):

shop1.erl
 
-module​(shop1).
 
-export​([total/1]).
 
 
total([{What, N}|T]) -> shop:cost(What) * N + total(T);
 
total([]) -> 0.

This bar contains the path to the code within the download. If you’re reading the ebook version of this book and your ebook reader supports hyperlinks, you can click the bar, and the code should appear in a browser window.

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.