TL;DR
In the previous post, we presented how to run modules and functions in runtime. Elixir is integrated with Erlang. Today we present how to run pure Erlang functions from Elixir. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.
Pure Erlang Function
In previous post we used our first pure Erlang function from Elixir:
:code.get_path
Before inventing the wheel in your own Module, first seach for that functionality in Erlang Module
Dynamic Execution
Elixir is static language because it requires compilation before execution. But it is possible to execute an Elixir function in runtime using Kernel.apply
function. You will see a lot of this function in stack traces, during the development of your future applications.
Remember
- find Erlang Module
- use its name as atom
- how to dynamically execute Elixir function
Comments are closed.