Learning Elixir

Learning Elixir

Language: English

Pages: 286

ISBN: 1785881744

Format: PDF / Kindle (mobi) / ePub

Learning Elixir

Language: English

Pages: 286

ISBN: 1785881744

Format: PDF / Kindle (mobi) / ePub

Key Features

  • Explore the functional paradigms of programming with Elixir through use of helpful examples
  • Concise step-by-step instructions to teach you difficult technical concepts
  • Bridge the gap between functional programming and Elixir

Book Description

Elixir, based on Erlang's virtual machine and ecosystem, makes it easier to achieve scalability, concurrency, fault tolerance, and high availability goals that are pursued by developers using any programming language or programming paradigm. Elixir is a modern programming language that utilizes the benefits offered by Erlang VM without really incorporating the complex syntaxes of Erlang.

Learning to program using Elixir will teach many things that are very beneficial to programming as a craft, even if at the end of the day, the programmer isn't using Elixir. This book will teach you concepts and principles important to any complex, scalable, and resilient application. Mostly, applications are historically difficult to reason about, but using the concepts in this book, they will become easy and enjoyable. It will teach you the functional programing ropes, to enable them to create better and more scalable applications, and you will explore how Elixir can help you achieve new programming heights. You will also glean a firm understanding of basics of OTP and the available generic, provided functionality for creating resilient complex systems. Furthermore, you will learn the basics of metaprogramming: modifying and extending Elixir to suite your needs.

What you will learn

  • Explore Elixir to create resilient, scalable applications
  • Create fault-tolerant applications
  • Become better acquainted with Elixir code and see how it is structured to build and develop functional programs
  • Learn the basics of functional programming
  • Gain an understanding of effective OTP principles
  • Design program-distributed applications and systems
  • Write and create branching statements in Elixir
  • Learn to do more with less using Elixir's metaprogramming
  • Be familiar with the facilities Elixir provides for metaprogramming, macros, and extending the Elixir language

About the Author

Kenny Ballou is a life-long learner, developer, mathematician, and overall thinker. He enjoys solving problems, learning about technologies, and discussing new and different ideas.

He graduated from the Boise State University, majoring in applied mathematics, and minoring in computer science. He has been programming professionally for nearly a decade, and is currently working as a software developer for an analytics company in the Boise, Idaho area.

Apart from developing professionally, he is active in the open source community, contributing where he can.

When he is not developing, he enjoys reading, learning, and shredding the local mountains.

You can read more from him on his blog at https://kennyballou.com, check out his code on GitHub at https://github.com/kennyballou/, and follow him on Twitter at @kennyballou.

Table of Contents

  1. Introducing Elixir – Thinking Functionally
  2. Elixir Basics – Foundational Steps toward Functional Programming
  3. Modules and Functions – Creating Functional Building Blocks
  4. Collections and Stream Processing
  5. Control Flow – Occasionally You Need to Branch
  6. Concurrent Programming – Using Processes to Conquer Concurrency
  7. OTP – A Poor Name for a Rich Framework
  8. Distributed Elixir – Taking Concurrency to the Next Node
  9. Metaprogramming – Doing More with Less

C++ Primer (5th Edition)

Scala Cookbook: Recipes for Object-Oriented and Functional Programming

MongoDB in Action

Functional Programming Using F#
















random ordering on a list of numbers, we can just use Enum.shuffle/1 to randomize a list for us. Another example, the worst case, is that we can use our own reverse/1 or Enum.reverse/1: iex(3)> Sort.quicksort Enum.reverse 1..10 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Mix – the ladle of Elixir So far, we have only interacted with simple modules defined in scripts or the interactive prompt. But this will only take us so far. Eventually, we will need more than just scripts. We will need a source tree that

Elixir processes and the basics of message passing. Chapter 7, OTP – A Poor Name for a Rich Framework, continues the discussion of concurrent programming with Elixir, more specifically in the context of OTP, which is the framework introduced in Erlang for building robust distributed applications. Chapter 8, Distributed Elixir – Taking Concurrency to the Next Node, examines how to write Elixir that executes on multiple nodes, distributing the processing over possibly many computers. Chapter 9,

conditions below it. For a simplistic example, notice how the first statement here is the only thing that will ever return, always: iex(3)> cond do ...(3)> true -> "Always" ...(3)> true -> "Never" ...(3)> false -> "Similarly never" ...(3)> end "Always" [ 108 ] www.it-ebooks.info Chapter 5 Thus, take care of the ordering of your conditions when writing the cond expressions. Although the syntax of the previous examples may seem to imply that cond can only execute a single-line expression, this

required to create the new structure on top of performing the actual modifications. However, there is hope for both of these concerns. Firstly, with respect to performance considerations, functional programs can typically have more sophisticated tooling because it is not only easier for us to understand as mere mortals, but also the tools we write to parse, compile (translate), and execute the functional code written. Some interesting compiler optimizations can be achieved from the shared

:application.which_applications/0 is defined as {Application, Description, Vsn}, where Application is the name of the application, Description is either the application name in string form or an explanatory text of the application, and Vsn is the loaded version of the application (1). What does it mean for an application to be loaded? The Erlang VM has a method for hot-swapping code, and therefore, being able to keep track of the loaded module version becomes more important. So, the "loaded"

Download sample